Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 602099a

Browse files
committed
* various modules: #include "Python.h" and remove most remporary
renaming hacks
1 parent a967209 commit 602099a

6 files changed

Lines changed: 20 additions & 67 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,10 @@ None notimeout(int) int=0 or int=1
138138

139139
/* curses module */
140140

141-
#include "allobjects.h"
142-
#include "fileobject.h"
143-
#include "modsupport.h"
141+
#include "Python.h"
144142

145143
#include <curses.h>
146144

147-
#include "rename1.h"
148-
149145
typedef struct {
150146
PyObject_HEAD
151147
SCREEN *scr;

Modules/_tkinter.c

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
/* tkintermodule.c -- Interface to libtk.a and libtcl.a.
22
Copyright (C) 1994 Steen Lumholt */
33

4-
#if 0
5-
#include <Py/Python.h>
6-
#else
7-
8-
#include "allobjects.h"
9-
#include "pythonrun.h"
10-
#include "intrcheck.h"
11-
#include "modsupport.h"
12-
#include "sysmodule.h"
13-
14-
#ifndef PyObject
15-
#define PyObject object
16-
typedef struct methodlist PyMethodDef;
17-
#endif
18-
#define PyInit_tkinter inittkinter
19-
20-
#undef Py_True
21-
#define Py_True ((object *) &TrueObject)
22-
#undef True
23-
24-
#undef Py_False
25-
#define Py_False ((object *) &FalseObject)
26-
#undef False
4+
#include <Python.h>
275

28-
#undef Py_None
29-
#define Py_None (&NoObject)
30-
#undef None
31-
32-
#endif /* 0 */
6+
#define PyInit_tkinter inittkinter
337

348
#include <tcl.h>
359
#include <tk.h>

Modules/rotormodule.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,13 @@ NOTE: you MUST use the SAME key in rotor.newrotor()
5555

5656
/* Rotor objects */
5757

58-
#include "allobjects.h"
59-
#include "modsupport.h"
58+
#include "Python.h"
59+
6060
#include <stdio.h>
6161
#include <math.h>
6262
#define TRUE 1
6363
#define FALSE 0
6464

65-
/* This is temp until the renaming effort is done with Python */
66-
#include "rename1.h"
67-
6865
typedef struct {
6966
PyObject_HEAD
7067
int seed[3];

Modules/signalmodule.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2424

2525
/* Signal module -- many thanks to Lance Ellinghouse */
2626

27-
#include "allobjects.h"
28-
#include "modsupport.h"
29-
#include "ceval.h"
27+
#include "Python.h"
3028
#include "intrcheck.h"
3129

3230
#include <signal.h>
3331
#include <errno.h>
3432

35-
#include "rename1.h"
36-
3733
#ifndef SIG_ERR
3834
#define SIG_ERR ((RETSIGTYPE (*)())-1)
3935
#endif
@@ -103,6 +99,15 @@ PySignal_Handler(sig_num)
10399
PySignal_SignalHandlerArray[sig_num].tripped = 1;
104100
#ifdef WITH_THREAD
105101
}
102+
#endif
103+
#ifdef SIGCHLD
104+
if (sig_num == SIGCHLD) {
105+
/* To avoid infinite recursion, this signal remains
106+
reset until explicit re-instated.
107+
Don't clear the 'func' field as it is our pointer
108+
to the Python handler... */
109+
return;
110+
}
106111
#endif
107112
(void *)signal(sig_num, &PySignal_Handler);
108113
}

Modules/stropmodule.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,8 @@ strop_find(self, args)
206206
if (getargs(args, "(s#s#i)", &s, &len, &sub, &n, &i)) {
207207
if (i < 0)
208208
i += len;
209-
if (i < 0 || i+n > len) {
210-
err_setstr(ValueError, "start offset out of range");
211-
return NULL;
212-
}
209+
if (i < 0)
210+
i = 0;
213211
}
214212
else {
215213
err_clear();
@@ -242,10 +240,8 @@ strop_rfind(self, args)
242240
if (getargs(args, "(s#s#i)", &s, &len, &sub, &n, &i)) {
243241
if (i < 0)
244242
i += len;
245-
if (i < 0 || i+n > len) {
246-
err_setstr(ValueError, "start offset out of range");
247-
return NULL;
248-
}
243+
if (i < 0)
244+
i = 0;
249245
}
250246
else {
251247
err_clear();

Modules/termios.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
/* termiosmodule.c -- POSIX terminal I/O module implementation. */
22

3-
#if 0
4-
#include <Py/Python.h>
5-
#else
6-
7-
#include "allobjects.h"
8-
#include "pythonrun.h"
9-
#include "intrcheck.h"
10-
#include "modsupport.h"
11-
#include "sysmodule.h"
12-
13-
#ifndef PyObject
14-
#define PyObject object
15-
typedef struct methodlist PyMethodDef;
16-
#endif
3+
#include <Python.h>
174

185
#define PyInit_termios inittermios
196

20-
#endif /* 0 */
21-
227
#include <termios.h>
238

249
#define BAD "bad termios argument"

0 commit comments

Comments
 (0)