Victor Stinner
61691d8336
bpo-38353: Cleanup includes in the internal C API (GH-16548)
...
Use forward declaration of types to avoid includes in the internal C
API. Add also comment to justify other includes.
2019-10-02 23:51:20 +02:00
Joannah Nanjekye
37c2220698
bpo-35943: Prevent PyImport_GetModule() from returning a partially-initialized module (GH-15057)
2019-09-11 13:47:39 +01:00
Ben Lewis
92420b3e67
bpo-37409: fix relative import with no parent ( #14956 )
...
Relative imports use resolve_name to get the absolute target name,
which first seeks the current module's absolute package name from the globals:
If __package__ (and __spec__.parent) are missing then
import uses __name__, truncating the last segment if
the module is a submodule rather than a package __init__.py
(which it guesses from whether __path__ is defined).
The __name__ attempt should fail if there is no parent package (top level modules),
if __name__ is '__main__' (-m entry points), or both (scripts).
That is, if both __name__ has no subcomponents and the module does not seem
to be a package __init__ module then import should fail.
2019-09-11 11:09:47 +01:00
Ngalim Siregar
c5fa44944e
bpo-37444: Update differing exception between builtins and importlib (GH-14869)
...
Imports now raise `TypeError` instead of `ValueError` for relative import failures. This makes things consistent between `builtins.__import__` and `importlib.__import__` as well as using a more natural import for the failure.
https://bugs.python.org/issue37444
Automerge-Triggered-By: @brettcannon
2019-08-02 22:46:02 -07:00
Min ho Kim
c4cacc8c5e
Fix typos in comments, docs and test names ( #15018 )
...
* Fix typos in comments, docs and test names
* Update test_pyparse.py
account for change in string length
* Apply suggestion: splitable -> splittable
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu >
* Apply suggestion: splitable -> splittable
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu >
* Apply suggestion: Dealloccte -> Deallocate
Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu >
* Update posixmodule checksum.
* Reverse idlelib changes.
2019-07-30 18:16:13 -04:00
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
b45d259bdd
bpo-36710: Use tstate in pylifecycle.c (GH-14249)
...
In pylifecycle.c: pass tstate argument, rather than interp argument,
to functions.
2019-06-20 00:05:23 +02:00
Victor Stinner
987a0dcfa1
bpo-36710: Remove PyImport_Cleanup() function (GH-14221)
...
* Rename PyImport_Cleanup() to _PyImport_Cleanup() and move it to the
internal C API. Add 'tstate' parameters.
* Remove documentation of _PyImport_Init(), PyImport_Cleanup(),
_PyImport_Fini(). All three were documented as "For internal use
only.".
2019-06-19 10:36:10 +02:00
Victor Stinner
0a28f8d379
bpo-36710: Add tstate parameter in import.c (GH-14218)
...
* Add 'tstate' parameter to many internal import.c functions.
* _PyImportZip_Init() now gets 'tstate' parameter rather than
'interp'.
* Add 'interp' parameter to _PyState_ClearModules() and rename it
to _PyInterpreterState_ClearModules().
* Move private _PyImport_FindBuiltin() to the internal C API; add
'tstate' parameter to it.
* Remove private _PyImport_AddModuleObject() from the C API:
use public PyImport_AddModuleObject() instead.
* Remove private _PyImport_FindExtensionObjectEx() from the C API:
use private _PyImport_FindExtensionObject() instead.
2019-06-19 02:54:39 +02:00
Victor Stinner
0fd2c300c2
Revert "bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)" (GH-13795)
...
This reverts commit 396e0a8d9d .
2019-06-04 03:15:09 +02:00
Eric Snow
396e0a8d9d
bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)
...
https://bugs.python.org/issue36818
2019-05-31 21:16:47 -06:00
Zackery Spytz
249b7d59d8
bpo-20602: Do not clear sys.flags and sys.float_info during shutdown (GH-8096)
...
There is no need to clear these immutable objects during shutdown.
2019-05-30 13:08:24 +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
Victor Stinner
410b85a7f7
bpo-36900: import.c uses PyInterpreterState.core_config (GH-13278)
...
Move _PyImportZip_Init() to the internal C API and add an 'interp'
parameter.
2019-05-13 17:12:45 +02:00
Zackery Spytz
94a64e9cd4
bpo-24048: Save the live exception during import.c's remove_module() (GH-13005)
...
Save the live exception during the course of remove_module().
2019-05-08 12:31:23 -04:00
Victor Stinner
cb9fbd3588
bpo-36763: Make _PyCoreConfig.check_hash_pycs_mode public (GH-13052)
...
_PyCoreConfig: Rename _check_hash_pycs_mode field to
check_hash_pycs_mode (make it public) and change its type from "const
char*" to "wchar_t*".
2019-05-01 23:51:56 -04:00
Victor Stinner
9db0324712
bpo-36710: Add runtime parameter in gcmodule.c (GH-12958)
...
Add 'state' or 'runtime' parameter to functions in gcmodule.c to
avoid to rely directly on the global variable _PyRuntime.
2019-04-26 02:32:01 +02:00
Stefan Krah
027b09c5a1
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)
2019-03-25 21:50:58 +01:00
Stéphane Wirtel
0d765e3849
bpo-36362: Avoid unused variables when HAVE_DYNAMIC_LOADING is not defined (GH-12430)
...
https://bugs.python.org/issue36362
2019-03-19 16:37:20 -07:00
Serhiy Storchaka
a24107b04c
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
2019-02-25 17:59:46 +02:00
Zackery Spytz
89c4f90df9
bpo-35470: Fix a reference counting bug in _PyImport_FindExtensionObjectEx(). (GH-11128)
2019-01-10 18:12:31 +02:00
Serhiy Storchaka
8905fcc85a
bpo-35454: Fix miscellaneous minor issues in error handling. ( #11077 )
...
* bpo-35454: Fix miscellaneous minor issues in error handling.
* Fix a null pointer dereference.
2018-12-11 08:38:03 +02:00