summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-36900: Replace global conf vars with config (GH-13299)Victor Stinner2019-05-141-3/+7
| | | | | | Replace global configuration variables with core_config read from the current interpreter. Cleanup dynload_hpux.c.
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-2/+3
|
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | 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
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * 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".
* bpo-33237: Improve AttributeError message for partially initialized module. ↵Serhiy Storchaka2018-10-301-2/+39
| | | | (GH-6398)
* Fix misleading mentions of tp_size in comments (GH-9093)Peter Eisentraut2018-09-101-2/+2
| | | | Many type object initializations labeled a field "tp_size" in the comment, but the name of that field is tp_basicsize.
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-3/+2
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* bpo-33330: Write exceptions occurred in PyImport_Cleanup() to stderr. (GH-6606)Serhiy Storchaka2018-04-291-4/+6
| | | | They where silenced before.
* bpo-32374: m_traverse may be called with m_state=NULL (GH-5140)Marcel Plch2018-03-171-0/+21
| | | | | Multi-phase initialized modules allow m_traverse to be called while the module is still being initialized, so module authors may need to account for that.
* bpo-32225: Implementation of PEP 562 (#4731)Ivan Levkivskyi2017-12-141-4/+18
| | | | | Implement PEP 562: module __getattr__ and __dir__. The implementation simply updates module_getattro and module_dir.
* bpo-31492: Fix assertion failures in case of a module with a bad __name__ ↵Oren Milman2017-09-191-4/+1
| | | | attribute. (#3620)
* bpo-28411: Isolate PyInterpreterState.modules (#3575)Eric Snow2017-09-141-3/+9
| | | | | 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.
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-9/+3
| | | 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.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+1
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-041-3/+9
| | | sys.modules is the one true source.
* bpo-29793: Convert some builtin types constructors to Argument Clinic. (#615)Serhiy Storchaka2017-03-191-17/+24
|
* Issue #28748: Private variable _Py_PackageContext is now of type "const char *"Serhiy Storchaka2016-11-211-1/+1
| | | | rather of "char *".
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-2/+2
| | | | UTF-8 represenatation of Unicode objects.
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-4/+4
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-1/+1
|\ | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
| * Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-1/+1
| | | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* | Issue #27914: Fixed a comment in PyModule_ExcDef.Serhiy Storchaka2016-09-261-1/+1
| | | | | | | | Patch by Xiang Zhang.
* | Merge #27782 fix from 3.5Nick Coghlan2016-08-211-29/+35
|\ \ | |/
| * Issue #27782: Fix m_methods handling in multiphase initNick Coghlan2016-08-211-29/+35
| | | | | | | | | | | | | | | | Multi-phase extension module import now correctly allows the ``m_methods`` field to be used to add module level functions to instances of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang.
* | Issue #12946: Remove dead code in PyModule_GetDictBerker Peksag2016-08-191-2/+1
|/ | | | | | PyModule_NewObject already sets md_dict to PyDict_New(): m->md_dict = PyDict_New();
* Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|
* Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-2/+1
| | | | macro Py_SETREF.
* Issue #24268: Address some PEP 489 refleaksNick Coghlan2015-05-231-0/+1
| | | | | | | | - missing DECREF in PyModule_FromDefAndSpec2 - missing DECREF in PyType_FromSpecAndBases2 - missing DECREF in _testmultiphase module Patch by Petr Viktorin
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-52/+283
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-1/+1
|
* sprinkle some _PyId goodness around moduleobject.cBenjamin Peterson2014-04-241-9/+19
|
* do not override errors from descriptors on modulesBenjamin Peterson2014-04-241-10/+9
|
* Issue8297: module attribute lookup failures now include module name in error ↵Ethan Furman2014-04-241-2/+26
| | | | message.
* Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.Serhiy Storchaka2014-02-121-2/+4
|\ | | | | | | This silences a Coverity complain.
| * Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.Serhiy Storchaka2014-02-121-2/+4
| | | | | | | | This silences a Coverity complain.
* | Issue #19255: The builtins module is restored to initial value beforeSerhiy Storchaka2014-02-101-5/+8
| | | | | | | | cleaning other modules. The sys and builtins modules are cleaned last.
* | Implement PEP 451 (ModuleSpec).Eric Snow2013-11-221-48/+5
| |
* | Issue #18214: Improve finalization of Python modules to avoid setting their ↵Antoine Pitrou2013-07-311-8/+21
| | | | | | | | globals to None, in most cases.
* | #17115,17116: Have modules initialize the __package__ and __loader__Brett Cannon2013-05-041-13/+26
|/ | | | | | | | | | | | | | | | | attributes to None. The long-term goal is for people to be able to rely on these attributes existing and checking for None to see if they have been set. Since import itself sets these attributes when a loader does not the only instances when the attributes are None are from someone overloading __import__() and not using a loader or someone creating a module from scratch. This patch also unifies module initialization. Before you could have different attributes with default values depending on how the module object was created. Now the only way to not get the same default set of attributes is to circumvent initialization by calling ModuleType.__new__() directly.
* Issue #15394: Fix ref leaks in PyModule_Create.Meador Inge2012-07-191-1/+7
|\ | | | | | | Patch by Julia Lawall.
| * Issue #15394: Fix ref leaks in PyModule_Create.Meador Inge2012-07-191-1/+7
| | | | | | | | Patch by Julia Lawall.
* | issue 14660: Implement PEP 420, namespace packages.Eric V. Smith2012-05-251-2/+31
| |
* | Issues #13959, 14647: Re-implement imp.reload() in Lib/imp.py.Brett Cannon2012-04-291-1/+1
| | | | | | | | Thanks to Eric Snow for the patch.
* | Rename _Py_identifier to _Py_IDENTIFIER.Martin v. Löwis2011-10-141-1/+1
| |
* | Use identifier API for PyObject_GetAttrString.Martin v. Löwis2011-10-101-1/+2
| |
* | Implement PEP 393.Martin v. Löwis2011-09-281-5/+4
| |
* | indicate return value on __dir__ methodsBenjamin Peterson2011-05-241-1/+1
| |
* | move specialized dir implementations into __dir__ methods (closes #12166)Benjamin Peterson2011-05-241-1/+29
| |
* | Issue #3080: Add PyModule_NewObject() functionVictor Stinner2011-03-041-7/+16
| |
* | Issue #3080: Add PyModule_GetNameObject()Victor Stinner2011-02-231-14/+29
|/ | | | | repr(module) uses %R to format module name and filenames, instead of '%s' and '%U', so surrogates from undecodable bytes in a filename (PEP 383) are escaped.