Jeroen Demeyer
59ad110d7a
bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)
2019-07-11 17:59:05 +09:00
Jeroen Demeyer
762f93ff2e
bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
2019-07-08 17:19:25 +09:00
Jeroen Demeyer
196a530e00
bpo-37483: add _PyObject_CallOneArg() function ( #14558 )
2019-07-04 19:31:34 +09:00
Victor Stinner
22eb689cf3
bpo-37388: Development mode check encoding and errors (GH-14341)
...
In development mode and in debug build, encoding and errors arguments
are now checked on string encoding and decoding operations. Examples:
open(), str.encode() and bytes.decode().
By default, for best performances, the errors argument is only
checked at the first encoding/decoding error, and the encoding
argument is sometimes ignored for empty strings.
2019-06-26 00:51:05 +02:00
Zackery Spytz
36dcaab7fd
Fix the error handling in bytesio_sizeof(). (GH-10459)
...
bytesio_sizeof() must check if an error has occurred in _PySys_GetSizeOf().
2019-06-02 00:07:45 +03:00
Jeroen Demeyer
530f506ac9
bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
...
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
2019-05-30 19:13:39 -07:00
Antoine Pitrou
ada319bb6d
bpo-32388: Remove cross-version binary compatibility requirement in tp_flags (GH-4944)
...
It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags.
This will reduce the risk of running out of bits in the 32-bit tp_flags value.
2019-05-29 22:12:38 +02:00
Victor Stinner
331a6a56e9
bpo-36763: Implement the PEP 587 (GH-13592)
...
* Add a whole new documentation page:
"Python Initialization Configuration"
* PyWideStringList_Append() return type is now PyStatus,
instead of int
* PyInterpreterState_New() now calls PyConfig_Clear() if
PyConfig_InitPythonConfig() fails.
* Rename files:
* Python/coreconfig.c => Python/initconfig.c
* Include/cpython/coreconfig.h => Include/cpython/initconfig.h
* Include/internal/: pycore_coreconfig.h => pycore_initconfig.h
* Rename structures
* _PyCoreConfig => PyConfig
* _PyPreConfig => PyPreConfig
* _PyInitError => PyStatus
* _PyWstrList => PyWideStringList
* Rename PyConfig fields:
* use_module_search_paths => module_search_paths_set
* module_search_path_env => pythonpath_env
* Rename PyStatus field: _func => func
* PyInterpreterState: rename core_config field to config
* Rename macros and functions:
* _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv()
* _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv()
* _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString()
* _PyInitError_Failed() => PyStatus_Exception()
* _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx
* _Py_UnixMain() => Py_BytesMain()
* _Py_ExitInitError() => Py_ExitStatusException()
* _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs()
* _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs()
* _Py_PreInitialize() => Py_PreInitialize()
* _Py_RunMain() => Py_RunMain()
* _Py_InitializeFromConfig() => Py_InitializeFromConfig()
* _Py_INIT_XXX() => _PyStatus_XXX()
* _Py_INIT_FAILED() => _PyStatus_EXCEPTION()
* Rename 'err' PyStatus variables to 'status'
* Convert RUN_CODE() macro to config_run_code() static inline function
* Remove functions:
* _Py_InitializeFromArgs()
* _Py_InitializeFromWideArgs()
* _PyInterpreterState_GetCoreConfig()
2019-05-27 16:39:22 +02:00
Steve Dower
b82e17e626
bpo-36842: Implement PEP 578 (GH-12613)
...
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
2019-05-23 08:45:22 -07:00
Inada Naoki
bfba8c373e
bpo-36748: optimize TextIOWrapper.write() for ASCII string (GH-13002)
2019-05-16 15:03:20 +09:00
Victor Stinner
c96be811fa
bpo-36900: Replace global conf vars with config (GH-13299)
...
Replace global configuration variables with core_config read from the
current interpreter.
Cleanup dynload_hpux.c.
2019-05-14 17:34:56 +02:00
Berker Peksag
21a9ba1992
bpo-2091: Fix typo in exception message (GH-12987)
2019-04-27 22:40:45 +03:00
Marcin Niemira
ab86521a9d
bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)
2019-04-22 20:13:51 +09:00
Victor Stinner
44235041f3
bpo-18748: io.IOBase destructor now logs close() errors in dev mode (GH-12786)
...
In development mode (-X dev) and in debug build, the io.IOBase
destructor now logs close() exceptions. These exceptions are silent
by default in release mode.
2019-04-12 17:06:47 +02:00
Serhiy Storchaka
3191391515
bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058)
2019-03-14 10:32:22 +02:00
Serhiy Storchaka
d53fe5f407
bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)
2019-03-13 22:59:55 +02:00
Inada Naoki
8c17d928eb
add missing break statement (GH-12147)
...
Bug introduced by 848037c
.
2019-03-03 08:22:39 -08:00
ngie-eign
848037c147
Use names SEEK_SET, etc instead of magic number (GH-12057)
...
The previous code hardcoded `SEEK_SET`, etc. While it's very unlikely
that these values will change, it's best to use the definitions to avoid
there being mismatches in behavior with the code in the future.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2019-03-03 16:28:26 +09:00
Serhiy Storchaka
2a39d251f0
bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)
...
Use _PyArg_CheckPositional() and inlined code instead of
PyArg_UnpackTuple() and _PyArg_UnpackStack() if all parameters
are positional and use the "object" converter.
2019-01-11 18:01:42 +02:00
Serhiy Storchaka
4fa9591025
bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313)
2019-01-11 16:01:14 +02:00
Serhiy Storchaka
32d96a2b5b
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)
2018-12-25 13:23:47 +02:00
Zackery Spytz
842acaab13
bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175)
2018-12-17 16:52:45 +02:00
Zackery Spytz
4c49da0cb7
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015)
...
Set MemoryError when appropriate, add missing failure checks,
and fix some potential leaks.
2018-12-07 12:11:30 +02:00
Serhiy Storchaka
d4f9cf5545
bpo-33029: Fix signatures of getter and setter functions. (GH-10746)
...
Fix also return type for few other functions (clear, releasebuffer).
2018-11-27 19:34:35 +02:00
Serhiy Storchaka
4a934d490f
bpo-33012: Fix invalid function cast warnings with gcc 8 in Argument Clinic. (GH-6748)
...
Fix invalid function cast warnings with gcc 8
for method conventions different from METH_NOARGS, METH_O and
METH_VARARGS in Argument Clinic generated code.
2018-11-27 11:27:36 +02:00
Victor Stinner
bcda8f1d42
bpo-35081: Add Include/internal/pycore_object.h (GH-10640)
...
Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from
Include/objimpl.h to Include/internal/pycore_object.h.
2018-11-21 22:27:47 +01:00
Victor Stinner
621cebe81b
bpo-35081: Rename internal headers (GH-10275)
...
Rename Include/internal/ headers:
* pycore_hash.h -> pycore_pyhash.h
* pycore_lifecycle.h -> pycore_pylifecycle.h
* pycore_mem.h -> pycore_pymem.h
* pycore_state.h -> pycore_pystate.h
Add missing headers to Makefile.pre.in and PCbuild:
* pycore_condvar.h.
* pycore_hamt.h
* pycore_pyhash.h
2018-11-12 16:53:38 +01:00
Serhiy Storchaka
34fd4c2019
bpo-35133: Fix mistakes when concatenate string literals on different lines. (GH-10284)
...
Two kind of mistakes:
1. Missed space. After concatenating there is no space between words.
2. Missed comma. Causes unintentional concatenating in a list of strings.
2018-11-05 16:20:25 +02:00
Victor Stinner
e281f7d80c
bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)
...
The accu.h header is no longer part of the Python C API: it has been
moved to the "internal" headers which are restricted to Python
itself.
Replace #include "accu.h" with #include "pycore_accu.h".
2018-11-01 02:30:36 +01:00
Victor Stinner
27e2d1f219
bpo-35081: Add pycore_ prefix to internal header files (GH-10263)
...
* Rename Include/internal/ header files:
* pyatomic.h -> pycore_atomic.h
* ceval.h -> pycore_ceval.h
* condvar.h -> pycore_condvar.h
* context.h -> pycore_context.h
* pygetopt.h -> pycore_getopt.h
* gil.h -> pycore_gil.h
* hamt.h -> pycore_hamt.h
* hash.h -> pycore_hash.h
* mem.h -> pycore_mem.h
* pystate.h -> pycore_state.h
* warnings.h -> pycore_warnings.h
* PCbuild project, Makefile.pre.in, Modules/Setup: add the
Include/internal/ directory to the search paths of header files.
* Update includes. For example, replace #include "internal/mem.h"
with #include "pycore_mem.h".
2018-11-01 00:52:28 +01:00
Xiang Zhang
b08746bfdf
bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
...
_io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range
value to the bitwise struct field.
2018-10-31 19:49:16 +08:00
Serhiy Storchaka
0353b4eaaf
bpo-33138: Change standard error message for non-pickleable and non-copyable types. (GH-6239)
2018-10-31 02:28:07 +02:00
Alexey Izbyshev
a2670565d8
bpo-32236: open() emits RuntimeWarning if buffering=1 for binary mode (GH-4842)
...
If buffering=1 is specified for open() in binary mode, it is silently
treated as buffering=-1 (i.e., the default buffer size).
Coupled with the fact that line buffering is always supported in Python 2,
such behavior caused several issues (e.g., bpo-10344, bpo-21332).
Warn that line buffering is not supported if open() is called with
binary mode and buffering=1.
2018-10-20 02:22:31 +02:00
David Herberth
8deab96725
bpo-34070: open() only checks for isatty if buffering < 0 (GH-8187)
2018-10-20 00:32:04 +02:00
Stéphane Wirtel
74a8b6ea7e
bpo-24658: Fix read/write greater than 2 GiB on macOS (GH-1705)
...
On macOS, fix reading from and writing into a file with a size larger than 2 GiB.
2018-10-18 01:05:04 +02:00
Benjamin Peterson
e502451781
closes bpo-34646: Remove PyAPI_* macros from declarations. (GH-9218)
2018-09-12 12:06:42 -07:00
Erik Janssens
e6a4755e67
bpo-34217: Use lowercase for windows headers (GH-8472)
2018-08-16 15:40:50 +09:00
jdemeyer
fc512e3e06
bpo-34287: Do not use second argument of METH_NOARGS functions (GH-8582)
2018-08-02 20:14:54 +09:00
ValeriyaSinevich
ce75df3031
bpo-30237: Output error when ReadConsole is canceled by CancelSynchronousIo. (GH-7911)
2018-07-19 15:34:03 -07:00
Zackery Spytz
28f07364f0
bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an exception set (GH-8282)
2018-07-17 09:31:44 +03:00
Serhiy Storchaka
fdb5a50ef3
bpo-25862: Fix several bugs in the _io module. (GH-8026)
...
They can be exposed when some C API calls fail due to lack of
memory.
* Failed Py_BuildValue() could cause an assertion error in the
following TextIOWrapper.tell().
* input_chunk could be decrefed twice in TextIOWrapper.seek()
after failed Py_BuildValue().
* initvalue could leak in StringIO.__getstate__() after failed
PyDict_Copy().
2018-06-30 20:57:50 +03:00
Zackery Spytz
23db935bcf
bpo-25862: Fix assertion failures in io.TextIOWrapper.tell(). (GH-3918)
2018-06-29 13:14:58 +03:00
Carl Meyer
c0ee341b29
Fix Windows build of Python for latest WinSDK. (GH-6874)
2018-05-17 14:03:59 -04:00
Siddhesh Poyarekar
55edd0c185
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
...
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments. This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
2018-04-29 21:59:33 +03:00
Serhiy Storchaka
42c35d9c0c
bpo-31966: Fixed WindowsConsoleIO.write() for writing empty data. (GH-5754)
2018-02-24 18:55:51 +02:00
Nitish Chandra
059f58ce93
bpo-32228: Reset raw_pos after unwinding the raw stream ( #4858 )
...
Ensure that ``truncate()`` preserves the file position (as reported by ``tell()``) after writes longer than the buffer size.
2018-01-28 17:00:09 +01:00
Serhiy Storchaka
f320be77ff
bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code (GH-5222)
...
Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
2018-01-25 17:49:40 +09:00
Serhiy Storchaka
4d9aec0220
bpo-31572: Get rid of PyObject_HasAttr() and _PyObject_HasAttrId() in the _io module. ( #3726 )
2018-01-16 18:34:21 +02:00
Benjamin Peterson
0a37a30037
closes bpo-32460: ensure all non-static globals have initializers ( #5061 )
2017-12-31 10:04:13 -08:00
INADA Naoki
4856b0f34a
bpo-32402: io: Add missing NULL check. (GH-4971)
...
_PyUnicode_FromId() may return NULL.
Reported by coverity scan: CID 1426868, 1426867.
2017-12-24 10:29:19 +09:00