Serhiy Storchaka
a5552f023e
bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. ( #4746 )
2017-12-15 13:11:11 +02:00
Ivan Levkivskyi
2b5fd1e9ca
bpo-32226: Implementation of PEP 560 (core components) ( #4732 )
...
This part of the PEP implementation adds support for
__mro_entries__ and __class_getitem__ by updating
__build_class__ and PyObject_GetItem.
2017-12-14 23:32:56 +01:00
Victor Stinner
91106cd9ff
bpo-29240: PEP 540: Add a new UTF-8 Mode ( #855 )
...
* Add -X utf8 command line option, PYTHONUTF8 environment variable
and a new sys.flags.utf8_mode flag.
* If the LC_CTYPE locale is "C" at startup: enable automatically the
UTF-8 mode.
* Add _winapi.GetACP(). encodings._alias_mbcs() now calls
_winapi.GetACP() to get the ANSI code page
* locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8
mode. As a side effect, open() now uses the UTF-8 encoding by
default in this mode.
* Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding
in the UTF-8 Mode.
* Update subprocess._args_from_interpreter_flags() to handle -X utf8
* Skip some tests relying on the current locale if the UTF-8 mode is
enabled.
* Add test_utf8mode.py.
* _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to
return also the length (number of wide characters).
* pymain_get_global_config() and pymain_set_global_config() now
always copy flag values, rather than only copying if the new value
is greater than the old value.
2017-12-13 12:29:09 +01:00
Serhiy Storchaka
aca7f574b0
bpo-30950: Convert round() to Argument Clinic. ( #2740 )
2017-11-15 17:51:14 +02:00
Serhiy Storchaka
e2f92de6a9
Add the const qualifier to "char *" variables that refer to literal strings. ( #4370 )
2017-11-11 13:06:26 +02:00
Barry Warsaw
36c1d1f1e5
PEP 553 built-in breakpoint() function (bpo-31353) ( #3355 )
...
Implement PEP 553, built-in breakpoint() with support from sys.breakpointhook(), along with documentation and tests. Closes bpo-31353
2017-10-05 12:11:18 -04:00
Oren Milman
5837d0418f
bpo-31588: Validate return value of __prepare__() methods (GH-3764)
...
Class execution requires that __prepare__() methods return
a proper execution namespace. Check for that immediately
after calling __prepare__(), rather than passing it through
to the code execution machinery and potentially triggering
SystemError (in debug builds) or a cryptic TypeError
(in release builds).
Patch by Oren Milman.
2017-09-28 00:04:37 +10:00
Eric Snow
d393c1b227
bpo-28411: Isolate PyInterpreterState.modules ( #3575 )
...
A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason.
Note that this code was already reviewed and merged as part of #1638 . I reverted that and am now splitting it up into more focused parts.
2017-09-14 12:18:12 -06:00
Eric Snow
93c92f7d1d
bpo-31404: Revert "remove modules from Py_InterpreterState ( #1638 )" ( #3565 )
...
PR #1638 , for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506 , a fix on top of #1638 , is also getting reverted.
2017-09-13 23:46:04 -07:00
Eric Snow
86b7afdfee
bpo-28411: Remove "modules" field from Py_InterpreterState. ( #1638 )
...
sys.modules is the one true source.
2017-09-04 17:54:09 -06:00
Oren Milman
58cf7488d5
bpo-31236: Improved some error messages of min() and max().
2017-08-21 20:19:07 +03:00
Serhiy Storchaka
6969eaf468
bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make ( #1955 )
...
the bare METH_FASTCALL be used for functions with positional-only
parameters.
2017-07-03 21:20:15 +03:00
Sylvain
96c7c06850
bpo-20627: Fix error message when keyword arguments are used ( #2115 )
2017-06-15 18:05:23 +03:00
Serhiy Storchaka
6cca5c8459
bpo-30592: Fixed error messages for some builtins. ( #1996 )
...
Error messages when pass keyword arguments to some builtins that
don't support keyword arguments contained double parenthesis: "()()".
The regression was introduced by bpo-30534.
2017-06-08 14:41:19 +03:00
Amit Kumar
2e6bb4484e
Add reference to help('FORMATTING') in format() builtin (GH-166)
2017-05-29 11:02:26 +10:00
Serhiy Storchaka
bf623ae884
bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() ( #1096 )
...
raised an error.
Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +03:00
Serhiy Storchaka
813f943c59
bpo-29838: Add asserts for checking results of sq_length and mq_length slots. ( #700 )
...
Negative result should be returned only when an error is set.
2017-04-16 09:21:44 +03:00
Serhiy Storchaka
c2cf128571
bpo-8256: Fixed possible failing or crashing input() ( #517 )
...
if attributes "encoding" or "errors" of sys.stdin or sys.stdout
are not set or are not strings.
2017-03-12 13:50:36 +02:00
Serhiy Storchaka
202fda55c2
bpo-24037: Add Argument Clinic converter `bool(accept={int})`. ( #485 )
2017-03-12 10:10:47 +02:00
Yen Chi Hsuan
72e81d00ee
bpo-29556: Remove unused #include <langinfo.h> ( #98 )
...
bltinmodule.c: Added in b744ba1
and no longer necessary since d64e8a7
posixmodule.c: Added in d1cd4d4
and no longer necessary since efb00c0
pythonrun.c: Added in 73d538b
and no longer necessary since d600951
sysmodule.c: Added in 5467d4c
and no longer necessary since a2c17c5
2017-02-16 00:34:30 +01:00
Serhiy Storchaka
9fa4a120f0
Issue #26729 : Fixed __text_signature__ for sorted().
...
Patch by Erik Welch.
2017-01-23 12:30:59 +02:00
Serhiy Storchaka
ad9422559f
Issue #26729 : Fixed __text_signature__ for sorted().
...
Patch by Erik Welch.
2017-01-23 12:30:35 +02:00
Serhiy Storchaka
3a1042567c
Issue #26729 : Fixed __text_signature__ for sorted().
...
Patch by Erik Welch.
2017-01-23 12:29:47 +02:00
Serhiy Storchaka
228b12edcc
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
...
possible. Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Serhiy Storchaka
7cf8bebb07
Issue #29331 : Simplified argument parsing in sorted() and list.sort().
2017-01-21 23:05:00 +02:00
Serhiy Storchaka
299dc239fe
Issue #29327 : Fixed a crash when pass the iterable keyword argument to sorted().
2017-01-20 08:35:18 +02:00
Serhiy Storchaka
398ef5c08f
Issue #29327 : Fixed a crash when pass the iterable keyword argument to sorted().
2017-01-20 08:33:06 +02:00
INADA Naoki
bd584f169f
Issue #29296 : convert print() to METH_FASTCALL
...
* Replace PyArg_ParseTupleAndKeywords() with _PyArg_ParseStackAndKeywords()
which is more efficient to parse keywords, since it decodes only keywords
(char*) from UTF-8 once, instead of decoding at each call.
* METH_FASTCALL avoids the creation of a temporary tuple to pass positional
arguments.
Patch written by INADA Naoki, pushed by Victor Stinner.
2017-01-19 12:50:34 +01:00
Victor Stinner
5a60ecaa7a
sorted() uses METH_FASTCALL
2017-01-17 15:17:49 +01:00
Victor Stinner
fda6d0acf0
next() uses FASTCALL
2017-01-17 04:09:14 +01:00
Victor Stinner
84b388bb80
getattr() uses METH_FASTCALL
2017-01-17 03:52:27 +01:00
Victor Stinner
773dc6dd06
__build_class__() builtin uses METH_FASTCALL
2017-01-16 23:46:26 +01:00
Victor Stinner
bc08ab4598
Add _PY_FASTCALL_SMALL_STACK constant
...
Issue #28870 : Add a new _PY_FASTCALL_SMALL_STACK constant, size of "small
stacks" allocated on the C stack to pass positional arguments to
_PyObject_FastCall().
_PyObject_Call_Prepend() now uses a small stack of 5 arguments (40 bytes)
instead of 8 (64 bytes), since it is modified to use _PY_FASTCALL_SMALL_STACK.
2016-12-15 12:40:53 +01:00
Victor Stinner
f17c3de263
Use _PyObject_CallNoArg()
...
Replace:
PyObject_CallFunctionObjArgs(callable, NULL)
with:
_PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Nick Coghlan
d77e5b7211
Merge #23722 from 3.6
2016-12-05 16:59:22 +10:00
Nick Coghlan
19d246745d
Issue #23722 : improve __classcell__ compatibility
...
Handling zero-argument super() in __init_subclass__ and
__set_name__ involved moving __class__ initialisation to
type.__new__. This requires cooperation from custom
metaclasses to ensure that the new __classcell__ entry
is passed along appropriately.
The initial implementation of that change resulted in abruptly
broken zero-argument super() support in metaclasses that didn't
adhere to the new requirements (such as Django's metaclass for
Model definitions).
The updated approach adopted here instead emits a deprecation
warning for those cases, and makes them work the same way they
did in Python 3.5.
This patch also improves the related class machinery documentation
to cover these details and to include more reader-friendly
cross-references and index entries.
2016-12-05 16:47:55 +10:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)
PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This change is part of the fastcall project. The change on listsort() is
related to the issue #23507 .
2016-12-01 14:43:22 +01:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Nick Coghlan
944368e1cc
Issue #23722 : Initialize __class__ from type.__new__()
...
The __class__ cell used by zero-argument super() is now initialized
from type.__new__ rather than __build_class__, so class methods
relying on that will now work correctly when called from metaclass
methods during class creation.
Patch by Martin Teichmann.
2016-09-11 14:45:49 +10:00
Eric Snow
4f29e75289
Issue #24254 : Drop cls.__definition_order__.
2016-09-08 15:11:11 -07:00
Raymond Hettinger
f0f1c239e4
Issue 27936: Fix inconsistent round() behavior between float and int
2016-09-03 01:55:11 -07:00
Steve Dower
cc16be85c0
Issue #27781 : Change file system encoding on Windows to UTF-8 (PEP 529)
2016-09-08 10:35:16 -07:00
Victor Stinner
3466bde1cc
Avoid calling functions with an empty string as format string
...
Directly pass NULL rather than an empty string.
2016-09-05 18:16:01 -07:00
Eric Snow
92a6c170e6
Issue #24254 : Preserve class attribute definition order.
2016-09-05 14:50:11 -07:00
Raymond Hettinger
3b09cd64e0
Merge
2016-09-03 01:55:39 -07:00
Raymond Hettinger
f74c33ad5c
Merge
2016-08-25 21:12:16 -07:00
Raymond Hettinger
7ea386e56e
Issue 19504: Change "customise" to "customize" American spelling.
2016-08-25 21:11:50 -07:00
Victor Stinner
74319ae219
Use Py_ssize_t type for number of arguments
...
Issue #27848 : use Py_ssize_t rather than C int for the number of function
positional and keyword arguments.
2016-08-25 00:04:09 +02:00
Victor Stinner
cdb5cee980
Issue #27809 : map_next() uses fast call
...
Use a small stack allocated in the C stack for up to 5 iterator functions,
otherwise allocates a stack on the heap memory.
2016-08-24 01:45:13 +02:00
Victor Stinner
f0cba67d0b
Backed out changeset 70f88b097f60 (map_next)
2016-08-24 00:54:47 +02:00
Victor Stinner
a9ba1ab21b
Issue #27809 : map_next() uses fast call
...
Use a small stack allocated in the C stack for up to 5 iterator functions,
otherwise allocates a stack on the heap memory.
2016-08-23 17:56:06 +02:00
Victor Stinner
d1c2a8e2b5
Issue #27809 : builtin___build_class__() uses fast call
2016-08-23 01:34:35 +02:00
Victor Stinner
463b86a881
Issue #27809 : Use _PyObject_FastCallDict()
...
Modify:
* init_subclass()
* builtin___build_class__()
Fix also a bug in init_subclass(): check for super() failure.
2016-08-22 23:33:13 +02:00
Victor Stinner
2990fa11bc
Issue #27809 : Use _PyObject_FastCallDict()
...
Modify:
* builtin_sorted()
* classmethoddescr_call()
* methoddescr_call()
* wrapperdescr_call()
2016-08-22 23:21:55 +02:00
Serhiy Storchaka
2954f83999
- Issue #27332 : Fixed the type of the first argument of module-level functions
...
generated by Argument Clinic. Patch by Petr Viktorin.
2016-07-07 18:20:03 +03:00
Serhiy Storchaka
1a2b24f02d
Issue #27332 : Fixed the type of the first argument of module-level functions
...
generated by Argument Clinic. Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Serhiy Storchaka
cfdfbb4d3c
Issue #27342 : Replaced some Py_XDECREFs with Py_DECREFs.
...
Patch by Xiang Zhang.
2016-06-18 09:44:03 +03:00
Serhiy Storchaka
24182a3aaa
Restored parameter name "self" since gdb needs exact specific parameter names.
2016-05-05 16:21:35 +03:00
Serhiy Storchaka
7a9579c0ce
Got rid of redundand "self" parameter declarations.
...
Argument Clinic is now able to infer all needed information.
2016-05-02 13:45:20 +03:00
Serhiy Storchaka
2e310b4c38
Regenerate Argument Clinic code for issue #26874 .
2016-05-01 20:34:00 +03:00
Serhiy Storchaka
df071730bb
Regenerate Argument Clinic code for issue #26874 .
2016-05-01 20:33:24 +03:00
Zachary Ware
5031a67821
Closes #26874 : Merge with 3.5
2016-04-28 14:40:08 -05:00
Zachary Ware
7f227d9087
Issue #26874 : Simplify the divmod docstring
2016-04-28 14:39:50 -05:00
Zachary Ware
54559b6511
Closes #26874 : Merge with 3.5
2016-04-28 14:25:32 -05:00
Zachary Ware
4d4160af6a
Issue #26874 : Fix divmod docstring
2016-04-28 14:24:55 -05:00
Serhiy Storchaka
21a663ea28
Issue #26057 : Got rid of nonneeded use of PyUnicode_FromObject().
2016-04-13 15:37:23 +03:00
Martin Panter
9513ba3b8f
Issue #24802 : Merge null termination fixes from 3.5
2015-11-07 03:15:32 +00:00
Martin Panter
61d6e4ae9d
Issue #24802 : Merge null termination fixes from 3.4 into 3.5
2015-11-07 02:56:11 +00:00
Martin Panter
eeb896c411
Issue #24802 : Copy bytes-like objects to null-terminated buffers if necessary
...
This avoids possible buffer overreads when int(), float(), compile(), exec()
and eval() are passed bytes-like objects. Similar code is removed from the
complex() constructor, where it was not reachable.
Patch by John Leitch, Serhiy Storchaka and Martin Panter.
2015-11-07 02:32:21 +00:00
Martin Panter
5344da5c0d
Issue #24402 : Merge input() fix from 3.5
2015-10-10 02:09:41 +00:00
Martin Panter
e02f8fc44d
Issue #24402 : Merge input() fix from 3.4 into 3.5
2015-10-10 01:55:23 +00:00
Martin Panter
c9a6ab56cf
Issue #24402 : Fix input() when stdout.fileno() fails; diagnosed by Eryksun
...
Also factored out some test cases into a new PtyTests class.
2015-10-10 01:25:38 +00:00
Raymond Hettinger
bd5f0e8c1c
Hoist constant expression out of the inner loop.
2015-10-09 01:34:08 -04:00
Raymond Hettinger
5098b58381
Make comparison more consistent
2015-10-09 00:42:47 -04:00
Raymond Hettinger
501b4a7398
Use PyTuple_GET_SIZE like the adjacent code does.
2015-08-18 08:07:16 -07:00
Raymond Hettinger
f109414094
Inline PyIter_Next() matching the other itertools code.
2015-08-18 00:20:20 -07:00
Serhiy Storchaka
8b2e8b6cce
Specify default values of semantic booleans in Argument Clinic generated signatures as booleans.
2015-05-30 11:30:39 +03:00
Serhiy Storchaka
7e810a6e3d
Use converter names instead of format units in Argument Clinic descriptions
...
in builtin and _crypt modules.
2015-05-30 11:09:35 +03:00
Larry Hastings
89964c48d1
Issue #23944 : Argument Clinic now wraps long impl prototypes at column 78.
2015-04-14 18:07:59 -04:00
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
2015-04-03 23:53:51 +03:00
Victor Stinner
0c39b1b970
Initialize variables to prevent GCC warnings
2015-03-18 15:02:06 +01:00
Serhiy Storchaka
3dd3e26680
Issue #22896 : Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
...
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka
4fdb68491e
Issue #22896 : Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
...
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
Serhiy Storchaka
d8a1447c99
Issue #22215 : Now ValueError is raised instead of TypeError when str or bytes
...
argument contains not permitted null character or byte.
2014-09-06 20:07:17 +03:00
Nick Coghlan
f9e227e5a9
Issue #20184 : Add signature introspection for 30 of the builtins
...
Also adds a test to test_inspect to track progress on builtin
introspection support, to ensure it doesn't regress in the future.
2014-08-17 14:01:19 +10:00
Victor Stinner
98ea54c35c
Issue #22156 : Fix "comparison between signed and unsigned integers" compiler
...
warnings in the Python/ subdirectory.
2014-08-15 23:30:40 +02:00
Zachary Ware
9b33872812
Issue #22146 : Fix typo in __build_class__ error message
2014-08-05 14:01:10 -05:00
Terry Jan Reedy
f2fb73f675
Issue #19362 : Tweek len() doc and docstring to expand the indicated range of
...
arguments. Original patch by Gareth Rees.
2014-06-16 03:05:37 -04:00
Raymond Hettinger
2a54582d72
Issue 20620: Update the min()/max() docs for the new default argument.
...
Patch provided by Berker Peksag.
2014-05-19 22:20:52 +01:00
Benjamin Peterson
5edbb7b7a4
correct len signature in docstring ( closes #21294 )
2014-04-18 01:03:59 -04:00
Larry Hastings
5c66189e88
Issue #20189 : Four additional builtin types (PyTypeObject,
...
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
2014-01-24 06:17:25 -08:00
Benjamin Peterson
d45a46b60d
merge 3.3 ( #19910 )
2013-12-06 20:12:51 -05:00
Benjamin Peterson
933142a8f2
document that compile() can take bytes ( closes #19910 )
2013-12-06 20:12:39 -05:00
Zachary Ware
a4b7a7548c
Issue #3158 : doctest can now find doctests in functions and methods
...
written in C.
As a part of this, a few doctests have been added to the builtins module
(on hex(), oct(), and bin()), a doctest has been fixed (hopefully on all
platforms) on float, and test_builtins now runs doctests in builtins.
2013-11-24 01:19:09 -06:00
Victor Stinner
bd303c165b
Issue #19512 , #19515 : remove shared identifiers, move identifiers where they
...
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner
eaa2883d15
Issue #19512 : builtin print() function uses an identifier instead of literal
...
string "flush" to call the flush method
2013-11-07 00:01:51 +01:00
Victor Stinner
ae9f161b43
Issue #19512 : __build_class() builtin now uses an identifier for the "metaclass" string
2013-11-06 22:46:51 +01:00
Victor Stinner
090543736f
Issue #19512 : add some common identifiers to only create common strings once,
...
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner
b44562b6b9
Issue #19512 : eval() and exec() now use an identifier for "__builtins__" string
2013-11-06 19:03:11 +01:00
Victor Stinner
41bb43a71e
Issue #18408 : Add a new PyFrame_FastToLocalsWithError() function to handle
...
exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.
2013-10-29 01:19:37 +01:00
Serhiy Storchaka
c679227e31
Issue #1772673 : The type of `char*` arguments now changed to `const char*`.
2013-10-19 21:03:34 +03:00
Serhiy Storchaka
46e1ce214b
Issue #18783 : Removed existing mentions of Python long type in docstrings,
...
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka
9594942716
Issue #18783 : Removed existing mentions of Python long type in docstrings,
...
error messages and comments.
2013-08-27 19:40:23 +03:00
Victor Stinner
14e461d5b9
Close #11619 : The parser and the import machinery do not encode Unicode
...
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Christian Heimes
4ebf6d7c3c
Issue #18560 : Fix potential NULL pointer dereference in sum()
2013-07-26 22:50:01 +02:00
Christian Heimes
704e2d374f
Issue #18560 : Fix potential NULL pointer dereference in sum()
2013-07-26 22:49:26 +02:00
Victor Stinner
1e53bbaced
Issue #18408 : handle PySys_GetObject() failure, raise a RuntimeError
2013-07-16 22:26:05 +02:00
R David Murray
acb362e29f
Merge: #18424 : PEP8ify the tense of the sum docstring.
2013-07-10 16:22:59 -04:00
R David Murray
87ead1138d
#18424 : PEP8ify the tense of the sum docstring.
2013-07-10 16:22:14 -04:00
Raymond Hettinger
4d6018fe45
Issue 18111: Add a default argument to min() and max()
2013-06-24 22:43:02 -07:00
Benjamin Peterson
e8e14591eb
rather than passing locals to the class body, just execute the class body in the proper environment
2013-05-16 14:37:25 -05:00
Benjamin Peterson
214a7d2674
properly lookup the __round__ special method ( closes #17722 )
2013-04-13 17:19:01 -04:00
Serhiy Storchaka
ee57f159af
Revert a premature patch for issue #14010 (changeset 846bd418aee5).
2013-04-06 22:55:12 +03:00
Serhiy Storchaka
278d03bd66
Revert a premature patch for issue #14010 (changeset aaaf36026511).
2013-04-06 22:52:34 +03:00
Serhiy Storchaka
aac81e2780
Issue #14010 : Fix a crash when iterating or deleting deeply nested filters
...
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:20:30 +03:00
Serhiy Storchaka
e8f706eda7
Issue #14010 : Fix a crash when iterating or deleting deeply nested filters
...
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:14:43 +03:00
Richard Oudkerk
eea1f5c2e4
Merge
2013-04-03 13:49:36 +01:00
Richard Oudkerk
614c578dec
Issue #17619 : Make input() check for Ctrl-C correctly on Windows.
2013-04-03 13:44:50 +01:00
Ezio Melotti
178e6fef9e
#17178 : merge with 3.3.
2013-02-15 23:38:23 +02:00
Ezio Melotti
293ab9728a
#17178 : merge with 3.2.
2013-02-15 23:38:05 +02:00
Ezio Melotti
b19ed57d8d
#17178 : update any()/all() docstrings to document their behavior with empty iterables. Patch by Ankur Ankan.
2013-02-15 23:35:14 +02:00
Philip Jenvey
f76f0eea5c
compile doesn't accept code objects
2012-12-13 15:44:18 -08:00
Benjamin Peterson
42124a727d
initialize map/filter/zip in _PyBuiltin_Init rather than the catch-all function
2012-10-30 23:41:54 -04:00
Stefan Krah
66d1eb23d4
Merge 3.2.
2012-08-20 17:20:46 +02:00
Stefan Krah
07795df683
Issue #15741 : Fix potential NULL dereference. Found by Coverity.
2012-08-20 17:19:50 +02:00
Antoine Pitrou
721738fbee
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:20:39 +02:00
Antoine Pitrou
6f430e4963
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:18:25 +02:00
Senthil Kumaran
e9175bd0af
Fix issue #15607 : Update the print builtin function docstring with the new flush keyword.
...
Patch contributed by Daniel Ellis.
2012-08-10 13:53:45 -07:00
Brett Cannon
cb4996afe4
Issue #15471 : Don't use mutable object as default values for the
...
parameters of importlib.__import__().
2012-08-06 16:34:44 -04:00
Brett Cannon
722d3aec2e
Issue #15508 : Fix the docstring for __import__ to not mention negative
...
'level' values and set its document default value to 0.
Thanks to Arfrever Frehtes Taifersar Arahesis for filing the bug.
2012-07-30 17:45:54 -04:00
Ezio Melotti
3c76aa6b23
Remove unused variabile "plain" in builtin_exec.
2012-11-21 18:36:08 +02:00
Antoine Pitrou
edc601855d
Remove outdated statement
2012-06-23 14:19:58 +02:00
Benjamin Peterson
3a37b8393c
merge 3.2
2012-06-01 23:57:50 -07:00
Benjamin Peterson
8e8fbeae27
don't leak if the __class__ closure is set
2012-06-01 23:57:36 -07:00
Brett Cannon
fd0741555b
Issue #2377 : Make importlib the implementation of __import__().
...
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
2012-04-03 10:49:41 +00:00
Benjamin Peterson
0010256de4
fold into one if statement
2012-01-11 21:00:16 -05:00
Benjamin Peterson
a12d5c62f7
fix formatting
2012-01-03 16:47:22 -06:00
Georg Brandl
bc3b682923
Closes #13761 : add a "flush" keyword argument to print().
2012-01-13 19:41:25 +01:00
Benjamin Peterson
0ab2a26865
merge 3.2
2012-01-11 21:00:48 -05:00
Benjamin Peterson
332503db07
merge 3.2
2012-01-03 16:48:14 -06:00
Victor Stinner
63ab875cfe
Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide
2011-11-22 03:31:20 +01:00
Philip Jenvey
50add04836
quote the type name for improved readability
2011-11-06 16:37:52 -08:00
Antoine Pitrou
5ee9d8a8a2
Issue #13342 : input() used to ignore sys.stdin's and sys.stdout's unicode
...
error handler in interactive mode (when calling into PyOS_Readline()).
2011-11-06 00:38:45 +01:00
Antoine Pitrou
0d776b1ce8
Issue #13342 : input() used to ignore sys.stdin's and sys.stdout's unicode
...
error handler in interactive mode (when calling into PyOS_Readline()).
2011-11-06 00:34:26 +01:00
Florent Xicluna
4d46c2a722
Remove unused variable.
2011-10-28 15:00:50 +02:00
Nick Coghlan
de31b191e5
Issue 1294232: Fix errors in metaclass calculation affecting some cases of metaclass inheritance. Patch by Daniel Urban.
2011-10-23 22:04:16 +10:00
Florent Xicluna
908ae24b06
Merge 3.2 (linked to issue #1294232 )
2011-10-28 15:06:13 +02:00
Nick Coghlan
9715d26305
Merge issue 1294232 patch from 3.2
2011-10-23 22:36:42 +10:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Martin v. Löwis
1ee1b6fe0d
Use identifier API for PyObject_GetAttrString.
2011-10-10 18:11:30 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Benjamin Peterson
ea281a54f3
include header with PyAST_Validate
2011-08-12 23:10:50 -05:00
Benjamin Peterson
832bfe2ebd
add a AST validator ( closes #12575 )
2011-08-09 16:15:04 -05:00
Benjamin Peterson
405f32c14c
plug refleak
2011-07-29 22:43:45 -05:00
Benjamin Peterson
4f921c2e06
bytes -> bytearray
2011-07-29 14:24:29 -05:00
Benjamin Peterson
ce071ca4e7
bytes should be verboten in sum() ( fixes #12654 )
2011-07-29 14:23:47 -05:00
Victor Stinner
99b9538636
Issue #9642 : Uniformize the tests on the availability of the mbcs codec
...
Add a new HAVE_MBCS define.
2011-07-04 14:23:54 +02:00
Victor Stinner
d64e8a75e5
Issue #9642 : Fix filesystem encoding initialization: use the ANSI code page on
...
Windows if the mbcs codec is not available, and fail with a fatal error if we
cannot get the locale encoding (if nl_langinfo(CODESET) is not available)
instead of using UTF-8.
2011-07-04 13:48:30 +02:00
Alexander Belopolsky
0df80926c9
Removed 'or long integer' from bin, oct, and hex docstrings.
2011-04-07 00:16:22 -04:00
Alexander Belopolsky
12338ab10b
Removed 'or long integer' from bin, oct, and hex docstrings.
2011-04-07 00:15:33 -04:00
Victor Stinner
fe93faf98c
Issue #3080 : Add PyImport_ImportModuleLevelObject() function
...
Use it for the builtin __import__ function.
2011-03-14 15:54:52 -04:00
Victor Stinner
f3fd733f92
Remove useless argument of _PyUnicode_AsDefaultEncodedString()
2011-03-02 01:03:11 +00:00
Victor Stinner
02bfdb3f79
Merged revisions 88530 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88530 | victor.stinner | 2011-02-23 13:07:37 +0100 (mer., 23 févr. 2011) | 4 lines
Issue #11272 : Fix input() and sys.stdin for Windows newline
On Windows, input() strips '\r' (and not only '\n'), and sys.stdin uses
universal newline (replace '\r\n' by '\n').
........
2011-02-23 12:10:23 +00:00
Victor Stinner
c0f1a1afae
Issue #11272 : Fix input() and sys.stdin for Windows newline
...
On Windows, input() strips '\r' (and not only '\n'), and sys.stdin uses
universal newline (replace '\r\n' by '\n').
2011-02-23 12:07:37 +00:00
Brett Cannon
b94767ff44
Issue #8914 : fix various warnings from the Clang static analyzer v254.
2011-02-22 20:15:44 +00:00
Georg Brandl
8334fd9285
Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.
2010-12-04 10:26:46 +00:00
Martin v. Löwis
4d0d471a80
Merge branches/pep-0384.
2010-12-03 20:14:31 +00:00
Georg Brandl
e5b99f0fb3
Remove redundant includes of headers that are already included by Python.h.
2010-11-30 09:41:01 +00:00
Antoine Pitrou
e71362d3de
Issue #10518 : Bring back the callable() builtin.
...
Approved by Guido (BDFL) and Georg (RM).
2010-11-27 22:00:11 +00:00
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Victor Stinner
4c7c8c3023
Issue #9713 , #10114 : Parser functions (eg. PyParser_ASTFromFile) expects
...
filenames encoded to the filesystem encoding with surrogateescape error handler
(to support undecodable bytes), instead of UTF-8 in strict mode.
2010-10-16 13:14:10 +00:00
Brett Cannon
5305a998d5
Since __import__ is not designed for general use, have its docstring point
...
people towards importlib.import_module().
Closes issue #7397 .
2010-09-27 21:08:38 +00:00
Victor Stinner
5b519e0201
Issue #9632 : Remove sys.setfilesystemencoding() function: use PYTHONFSENCODING
...
environment variable to set the filesystem encoding at Python startup.
sys.setfilesystemencoding() creates inconsistencies because it is unable to
reencode all filenames in all objects.
2010-09-10 21:57:59 +00:00
Benjamin Peterson
17689991e6
only catch AttributeError in hasattr() #9666
2010-08-24 03:26:23 +00:00
Victor Stinner
306f0100f3
Issue #6697 : Fix a crash if sys.stdin or sys.stdout encoding contain a surrogate
...
This is *very* unlikely :-)
2010-05-19 01:06:22 +00:00
Victor Stinner
b744ba1d14
Issue #8610 : Load file system codec at startup, and display a fatal error on
...
failure. Set the file system encoding to utf-8 (instead of None) if getting
the locale encoding failed, or if nl_langinfo(CODESET) function is missing.
2010-05-15 12:27:16 +00:00
Antoine Pitrou
f95a1b3c53
Recorded merge of revisions 81029 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Victor Stinner
120c21227a
Issue #8226 : sys.setfilesystemencoding() raises a LookupError if the encoding
...
is unknown.
2010-03-25 00:30:28 +00:00
Benjamin Peterson
09259e2043
check PyDict_New() for error
2010-02-27 17:41:13 +00:00
Benjamin Peterson
23e018ab98
only accept AttributeError as indicating no __prepare__ attribute on a metaclass, allowing lookup errors to propogate
2010-02-27 17:40:01 +00:00
Mark Dickinson
480e8e38a0
Fix typo (reported by terlop on IRC)
2009-12-19 21:19:35 +00:00
Benjamin Peterson
97dd987ae2
Merged revisions 76534,76538,76628,76701,76774 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76534 | martin.v.loewis | 2009-11-26 02:42:05 -0600 (Thu, 26 Nov 2009) | 2 lines
Fix typo.
........
r76538 | georg.brandl | 2009-11-26 14:48:25 -0600 (Thu, 26 Nov 2009) | 1 line
#7400 : typo.
........
r76628 | andrew.kuchling | 2009-12-02 08:27:11 -0600 (Wed, 02 Dec 2009) | 1 line
Markup fixes
........
r76701 | andrew.kuchling | 2009-12-07 20:37:05 -0600 (Mon, 07 Dec 2009) | 1 line
Typo fix; grammar fix
........
r76774 | benjamin.peterson | 2009-12-12 18:54:15 -0600 (Sat, 12 Dec 2009) | 1 line
account for PyObject_IsInstance's new ability to fail
........
2009-12-13 01:23:39 +00:00
Mark Dickinson
9acadc54e0
Merged revisions 75714 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75714 | mark.dickinson | 2009-10-26 14:18:44 +0000 (Mon, 26 Oct 2009) | 1 line
Warn against replacing PyNumber_Add with PyNumber_InPlaceAdd in sum
........
2009-10-26 14:19:42 +00:00
Skip Montanaro
ba1e0f46ab
Issue 7147 - remove ability to attempt to build Python without complex number support (was broken anyway)
2009-10-18 14:25:35 +00:00
Benjamin Peterson
c963731bb6
refactor logic a little when no sep or end is passed
2009-07-02 18:25:26 +00:00
Benjamin Peterson
8bc5b68159
these builtins have to be initialized
2009-05-09 18:10:51 +00:00
Benjamin Peterson
f5b52246ed
ignore the coding cookie in compile(), exec(), and eval() if the source is a string #4626
2009-03-02 23:31:26 +00:00
Mark Dickinson
e94c679df0
Issue #1717 : rename tp_compare to tp_reserved. I'll change the
...
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00
Mark Dickinson
f02e0aaafd
Issue #1717 : remove the cmp builtin function, the C-API functions
...
PyObject_Cmp, PyObject_Compare, and various support functions.
2009-02-01 12:13:56 +00:00
Mark Dickinson
1124e71368
Issue #4707 : round(x, n) now returns an integer when x is an integer.
...
Previously it returned a float.
2009-01-28 21:25:58 +00:00
Amaury Forgeot d'Arc
f343e01c17
Merged revisions 68560 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68560 | amaury.forgeotdarc | 2009-01-13 00:36:55 +0100 (mar., 13 janv. 2009) | 6 lines
#3720 : Interpreter crashes when an evil iterator removes its own next function.
Now the slot is filled with a function that always raises.
Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
........
2009-01-12 23:58:21 +00:00
Raymond Hettinger
5d1ff00bc0
Mini-optimization: use pack/unpack functions for argument tuples.
2009-01-06 09:37:13 +00:00
Benjamin Peterson
3809026a72
#4826 exec() doesn't take a file object anymore
2009-01-04 15:30:39 +00:00
Georg Brandl
ced51db8cf
#4513 : remove traces of zip() docstring from when it was izip().
2008-12-04 18:28:38 +00:00
Christian Heimes
6a27efa2d3
Issue 3723: Fixed initialization of subinterpreters
...
The patch fixes several issues with Py_NewInterpreter as well as the demo for multiple subinterpreters.
Most of the patch was written by MvL with help from Benjamin, Amaury and me. Graham Dumpleton has verified that this patch fixes an issue with mod_wsgi.
2008-10-30 21:48:26 +00:00
Martin v. Löwis
04dc25c537
Issue #3187 : Add sys.setfilesystemencoding.
2008-10-03 16:09:28 +00:00