Skip to content

Commit 32fbe59

Browse files
committed
Merged revisions 58939-58946 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r58940 | martin.v.loewis | 2007-11-12 05:53:02 +0100 (Mon, 12 Nov 2007) | 3 lines Only set rl_completion_display_matches_hook if there is a Python hook function. Fixes python#1425. ........ r58941 | martin.v.loewis | 2007-11-12 06:14:05 +0100 (Mon, 12 Nov 2007) | 2 lines Patch python#1418: Make the AC_REPLACE_FUNCS object files actually work. ........ r58942 | walter.doerwald | 2007-11-12 11:01:33 +0100 (Mon, 12 Nov 2007) | 2 lines Fix TextCalendar.prweek(). This closes issue python#1427. ........
1 parent 96f3163 commit 32fbe59

File tree

4 files changed

+46
-38
lines changed

4 files changed

+46
-38
lines changed

Lib/calendar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def prweek(self, theweek, width):
263263
"""
264264
Print a single week (no newline).
265265
"""
266-
print(self.week(theweek, width), end=' ')
266+
print(self.formatweek(theweek, width), end=' ')
267267

268268
def formatday(self, day, weekday, width):
269269
"""

Makefile.pre.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ THREADOBJ= @THREADOBJ@
169169
DLINCLDIR= @DLINCLDIR@
170170
DYNLOADFILE= @DYNLOADFILE@
171171
MACHDEP_OBJS= @MACHDEP_OBJS@
172+
LIBOBJDIR= Python/
173+
LIBOBJS= @LIBOBJS@
172174
UNICODE_OBJS= @UNICODE_OBJS@
173175

174176
PYTHON= python$(EXE)
@@ -276,6 +278,7 @@ PYTHON_OBJS= \
276278
Python/pystrtod.o \
277279
Python/formatter_unicode.o \
278280
Python/$(DYNLOADFILE) \
281+
$(LIBOBJS) \
279282
$(MACHDEP_OBJS) \
280283
$(THREADOBJ)
281284

Modules/readline.c

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
extern char **completion_matches(char *, rl_compentry_func_t *);
3939
#endif
4040

41+
static void
42+
on_completion_display_matches_hook(char **matches,
43+
int num_matches, int max_length);
44+
4145

4246
/* Exported function to send one line to readline's init file parser */
4347

@@ -208,8 +212,17 @@ static PyObject *pre_input_hook = NULL;
208212
static PyObject *
209213
set_completion_display_matches_hook(PyObject *self, PyObject *args)
210214
{
211-
return set_hook("completion_display_matches_hook",
215+
PyObject *result = set_hook("completion_display_matches_hook",
212216
&completion_display_matches_hook, args);
217+
#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
218+
/* We cannot set this hook globally, since it replaces the
219+
default completion display. */
220+
rl_completion_display_matches_hook =
221+
completion_display_matches_hook ?
222+
(rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
223+
#endif
224+
return result;
225+
213226
}
214227

215228
PyDoc_STRVAR(doc_set_completion_display_matches_hook,
@@ -668,44 +681,41 @@ static void
668681
on_completion_display_matches_hook(char **matches,
669682
int num_matches, int max_length)
670683
{
671-
if (completion_display_matches_hook != NULL) {
672-
int i;
673-
PyObject *m, *s, *match;
674-
PyObject *r;
684+
int i;
685+
PyObject *m, *s;
686+
PyObject *r;
675687
#ifdef WITH_THREAD
676-
PyGILState_STATE gilstate = PyGILState_Ensure();
688+
PyGILState_STATE gilstate = PyGILState_Ensure();
677689
#endif
678-
m = PyList_New(num_matches);
679-
for (i = 0; i < num_matches; i++) {
680-
s = PyUnicode_FromString(matches[i+1]);
681-
if (s) {
682-
PyList_SetItem(m, i, s);
683-
}
684-
else {
685-
goto error;
686-
}
690+
m = PyList_New(num_matches);
691+
for (i = 0; i < num_matches; i++) {
692+
s = PyUnicode_FromString(matches[i+1]);
693+
if (s) {
694+
PyList_SetItem(m, i, s);
695+
}
696+
else {
697+
goto error;
687698
}
688-
r = PyObject_CallFunction(completion_display_matches_hook,
689-
"sOi", matches[0], m, max_length);
699+
}
700+
r = PyObject_CallFunction(completion_display_matches_hook,
701+
"sOi", matches[0], m, max_length);
690702

691-
Py_DECREF(m), m=NULL;
703+
Py_DECREF(m), m=NULL;
692704

693-
if (r == NULL ||
694-
(r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) {
695-
goto error;
696-
}
705+
if (r == NULL ||
706+
(r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) {
707+
goto error;
708+
}
697709

698-
Py_DECREF(r);
699-
goto done;
700-
error:
701-
PyErr_Clear();
702-
Py_XDECREF(m);
703-
Py_XDECREF(r);
704-
done:
710+
Py_DECREF(r);
711+
goto done;
712+
error:
713+
PyErr_Clear();
714+
Py_XDECREF(r);
715+
done:
705716
#ifdef WITH_THREAD
706-
PyGILState_Release(gilstate);
717+
PyGILState_Release(gilstate);
707718
#endif
708-
}
709719
}
710720

711721

@@ -786,10 +796,6 @@ setup_readline(void)
786796
rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
787797
rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
788798
/* Set our hook functions */
789-
#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK
790-
rl_completion_display_matches_hook =
791-
(rl_compdisp_func_t *)on_completion_display_matches_hook;
792-
#endif
793799
rl_startup_hook = (Function *)on_startup_hook;
794800
#ifdef HAVE_RL_PRE_INPUT_HOOK
795801
rl_pre_input_hook = (Function *)on_pre_input_hook;

Python/hypot.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* hypot() replacement */
22

3-
#include "pyconfig.h"
4-
#include "pyport.h"
3+
#include "Python.h"
54

65
double hypot(double x, double y)
76
{

0 commit comments

Comments
 (0)