Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference implementation of __class_getitem__ and __mro_entries__ #2

Closed
wants to merge 220 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
26afdc6
POC implementation of __base_subclass__
ilevkivskyi Jul 19, 2017
3285fb6
POC implementation of __class_getitem__
ilevkivskyi Jul 19, 2017
779f85d
Modify __base_subclass__ API to support dynamic evaluation and base r…
ilevkivskyi Jul 20, 2017
5d5211d
Make __base_subclass__ faster and safer
ilevkivskyi Jul 20, 2017
41fa7e9
Factor out base update in a separate helper
ilevkivskyi Jul 20, 2017
5aeebab
Formatting
ilevkivskyi Jul 20, 2017
e858ea7
Also make __class_getitem__ safer
ilevkivskyi Jul 20, 2017
5b8d453
Simplify some code
ilevkivskyi Jul 21, 2017
b3e52f1
Initial work on typing2
ilevkivskyi Jul 22, 2017
6e7b575
Remove test implementation for typing
ilevkivskyi Sep 3, 2017
a8437fa
Rename base_subclass to subclass_base
Sep 7, 2017
c2d8ac2
Start adding tests
Sep 7, 2017
bc06c6b
Add tests for __subclass_base__
Sep 8, 2017
86c5d61
Add tests for __class_getitem__
Sep 8, 2017
2cef78a
Fix trailing whitespace
ilevkivskyi Sep 9, 2017
b9bbf7c
Alternative implementation of __class_getitem__
ilevkivskyi Sep 10, 2017
2495e94
Simplify code and fix reference counting
ilevkivskyi Sep 10, 2017
9ca8dfc
Rename __base_subclass__ to __mro_entry__
ilevkivskyi Nov 11, 2017
74bd36f
Add types.resolve_bases
ilevkivskyi Nov 11, 2017
6f20c45
Make Python and C versions as similar as possible
ilevkivskyi Nov 11, 2017
bcfbcf6
More tests
ilevkivskyi Nov 11, 2017
d7bd630
Fail fast in type.__new__
ilevkivskyi Nov 11, 2017
29e54c3
Fix a test
ilevkivskyi Nov 11, 2017
cba2a58
Test error message
ilevkivskyi Nov 11, 2017
966a9ea
Test error message
ilevkivskyi Nov 11, 2017
734c7e9
Test error message
ilevkivskyi Nov 11, 2017
e2f92de
Add the const qualifier to "char *" variables that refer to literal s…
serhiy-storchaka Nov 11, 2017
d4f8480
bpo-31572: Don't silence unexpected errors in the _warnings module. (…
serhiy-storchaka Nov 11, 2017
1707e40
bpo-31572: Silence only AttributeError when get the __copy__ attribut…
serhiy-storchaka Nov 11, 2017
60c3d35
bpo-31572: Get rid of _PyObject_HasAttrId() in dict and OrderedDict. …
serhiy-storchaka Nov 11, 2017
bba2239
bpo-31572: Get rid of _PyObject_HasAttrId() in the ASDL parser. (#3725)
serhiy-storchaka Nov 11, 2017
7c9da3e
Remove redundant 'exc = True' line (GH-4357)
berkerpeksag Nov 11, 2017
e197a85
The termios man page is in section 3 (GH-2450)
EdwardBetts Nov 11, 2017
9e78dc2
Move comments in configure.ac to more appropriate place. (#4371)
serhiy-storchaka Nov 11, 2017
1588be6
bpo-28180: Fix the implementation of PEP 538 on Android (GH-4334)
xdegaye Nov 12, 2017
e0582a3
bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160)
xdegaye Nov 12, 2017
92c2ca7
bpo-28759: Skip some tests on PermissionError raised by Android (GH-4…
xdegaye Nov 12, 2017
6a55d09
bpo-29180: Skip test_os tests on PermissionError raised by Android (G…
xdegaye Nov 12, 2017
d7d4fea
bpo-29181: Skip test_tarfile tests on PermissionError raised by Andro…
xdegaye Nov 12, 2017
8acaa31
remove detect_math_libs (#4383)
benjaminp Nov 13, 2017
f76231f
bpo-32013: _pickle: Add missing Py_DECREF in error case in fast_save_…
lioncash Nov 13, 2017
152d2f6
Allow expansion to multiple bases
Nov 13, 2017
ce12629
bpo-28369: Enhance transport socket check in add_reader/writer (#4365)
1st1 Nov 13, 2017
9b6c60c
bpo-31979: Simplify transforming decimals to ASCII (#4336)
serhiy-storchaka Nov 13, 2017
28b6248
bpo-16055: Fixes incorrect error text for int('1', base=1000) (#4376)
CuriousLearner Nov 13, 2017
56935a5
bpo-32020: arraymodule: Correct missing Py_DECREF in failure case of …
lioncash Nov 14, 2017
e1d62e0
bpo-32015: Asyncio looping during simultaneously socket read/write an…
andr-04 Nov 14, 2017
1a218e0
Prohibit returning non-tuple
ilevkivskyi Nov 14, 2017
7cc8d8f
Rename to __mro_entries__
ilevkivskyi Nov 14, 2017
b0b44b4
bpo-15606: Improve the re.VERBOSE documentation. (#4366)
serhiy-storchaka Nov 14, 2017
3bda022
bpo-31948: Fix broken links in msilib docs (GH-4397)
Jesse-Bakker Nov 14, 2017
9165f77
bpo-32012: Disallow trailing comma after genexpr without parenthesis.…
serhiy-storchaka Nov 15, 2017
2ae4ad7
Changed lambda to str.strip in _strip_spaces in logging.config (#4332)
snjypl Nov 15, 2017
6545256
bpo-32032: Test both implementations of module-level pickle API. (#4401)
serhiy-storchaka Nov 15, 2017
edad8ee
bpo-31949: Fixed several issues in printing tracebacks (PyTraceBack_P…
serhiy-storchaka Nov 15, 2017
ddbce13
bpo-32023: Disallow genexprs without parenthesis in class definitions…
serhiy-storchaka Nov 15, 2017
00987f6
bpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYP…
serhiy-storchaka Nov 15, 2017
aca7f57
bpo-30950: Convert round() to Argument Clinic. (#2740)
serhiy-storchaka Nov 15, 2017
f8a4c03
bpo-30399: Get rid of trailing comma in the repr of BaseException. (#…
serhiy-storchaka Nov 15, 2017
762b957
bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)
corona10 Nov 15, 2017
4bd41c9
bpo-32025: Add time.thread_time() (#4410)
pitrou Nov 15, 2017
43605e6
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409
1st1 Nov 15, 2017
f7e5b56
bpo-32030: Split Py_Main() into subfunctions (#4399)
vstinner Nov 15, 2017
a7368ac
bpo-32030: Enhance Py_Main() (#4412)
vstinner Nov 16, 2017
0a2abdf
bpo-30143: 2to3 now generates a code that uses abstract collection cl…
serhiy-storchaka Nov 16, 2017
3daaafb
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickl…
serhiy-storchaka Nov 16, 2017
05cb728
bpo-30349: Raise FutureWarning for nested sets and set operations (#1…
serhiy-storchaka Nov 16, 2017
ccb0442
bpo-32043: New "developer mode": "-X dev" option (#4413)
vstinner Nov 16, 2017
cede8c9
bpo-31702: Allow to specify rounds for SHA-2 hashing in crypt.mksalt(…
serhiy-storchaka Nov 16, 2017
d505a29
Fix typo in atexit documentation. (GH-4419)
embray Nov 16, 2017
fd0fa67
bpo-31691: Specify where to find build instructions for the Windows i…
native-api Nov 16, 2017
f2ddc6a
tokenizer: Remove unused tabs options (#4422)
vstinner Nov 17, 2017
f02f5e5
bpo-31867: Remove duplicates in default mimetypes. (#4388)
cryvate Nov 17, 2017
51d546a
bpo-32069: Drop legacy SSL transport (#4451)
asvetlov Nov 18, 2017
9001d1f
bpo-29184: Skip test_socketserver tests on PermissionError raised by …
xdegaye Nov 18, 2017
d34d8fc
bpo-29185: Fix `test_distutils` failures on Android (GH-4438)
xdegaye Nov 18, 2017
ebfaa71
bpo-32031: Fix pydoc `test_mixed_case_module_names_are_lower_cased` (…
xdegaye Nov 18, 2017
0c71653
[Doc] Update opcode for var-positional arguments (#4446)
mkoledoye Nov 18, 2017
7750bde
Document parameters of BaseServer.finish_request() (GH-4445)
ma8ma Nov 19, 2017
b56becb
Remove outdated .pyo reference from msilib docs (GH-4461)
berkerpeksag Nov 19, 2017
e96ba18
bpo-30904: Removed duplicated Host: header. (#4465)
vsajip Nov 19, 2017
04dee27
Remove duplicated import from datetime tests (#4444)
xrmx Nov 20, 2017
44862df
bpo-32047: -X dev enables asyncio debug mode (#4418)
vstinner Nov 20, 2017
c5a2071
bpo-32050: Fix -x option documentation (#4475)
vstinner Nov 20, 2017
895862a
bpo-32088: Display Deprecation in debug mode (#4474)
vstinner Nov 20, 2017
423fd36
bpo-32066: Support pathlib.Path in create_unix_connection; sock arg s…
1st1 Nov 20, 2017
f39b674
bpo-32094: Update subprocess for -X dev (#4480)
vstinner Nov 20, 2017
09f3a8a
bpo-32089: Fix warnings filters in dev mode (#4482)
vstinner Nov 21, 2017
25420fe
bpo-32030: Add more options to _PyCoreConfig (#4485)
vstinner Nov 21, 2017
bc9b6e2
bpo-32043: Rephrase -X dev documentation (#4478)
vstinner Nov 21, 2017
337cbba
Add comment and improve variable name in roundrobin() (#4486)
rhettinger Nov 21, 2017
e256b40
bpo-31672 - Add one last minor clarification for idpattern (#4483)
warsaw Nov 21, 2017
431665b
bpo-32105: add asyncio.BaseEventLoop.connect_accepted_socket versiona…
AraHaan Nov 21, 2017
803ddd8
bpo-31324: Optimize support._match_test() (#4421)
vstinner Nov 21, 2017
bb11c3c
bpo-31324: Fix test.support.set_match_tests(None) (#4505)
vstinner Nov 22, 2017
8265627
bpo-27535: Optimize warnings.warn() (#4508)
vstinner Nov 22, 2017
d434110
bpo-32030: Add _PyCoreConfig.module_search_path_env (#4504)
vstinner Nov 22, 2017
20d48a4
bpo-32100: IDLE: Fix pathbrowser errors; improve tests. (#4484)
csabella Nov 23, 2017
0784a2e
bpo-10049: Add a "no-op" (null) context manager to contextlib (GH-4464)
Jesse-Bakker Nov 23, 2017
e32e79f
bpo-32030: Move PYTHONPATH to _PyMainInterpreterConfig (#4511)
vstinner Nov 23, 2017
1f15111
bpo-32030: Add _PyMainInterpreterConfig.pythonhome (#4513)
vstinner Nov 23, 2017
5ad7ef8
bpo-28538: Revert all the changes (now using Android Unified Headers)…
xdegaye Nov 23, 2017
c06c22e
bpo-29040: Support building Android with Unified Headers (GH-4492)
xdegaye Nov 23, 2017
5ce1069
bpo-28762: Revert last commit (now using Android Unified Headers) (GH…
xdegaye Nov 23, 2017
bdb8315
bpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459)
berkerpeksag Nov 23, 2017
0327bde
bpo-32030: Rewrite calculate_path() (#4521)
vstinner Nov 23, 2017
b98f171
bpo-27535: Cleanup create_filter() (#4516)
vstinner Nov 23, 2017
b919795
bpo-32030: Fix calculate_path() on macOS (#4526)
vstinner Nov 23, 2017
6a54c67
bpo-31979: Remove unused align_maxchar() function (#4527)
vstinner Nov 23, 2017
dcaed6b
bpo-19610: setup() now raises TypeError for invalid types (GH-4519)
berkerpeksag Nov 23, 2017
0858495
bpo-32099 Add deque variant of roundrobin() recipe (#4497)
rhettinger Nov 23, 2017
3df02db
bpo-31325: Fix usage of namedtuple in RobotFileParser.parse() (#4529)
berkerpeksag Nov 23, 2017
cdfe910
Extending Python Doc minor updates (GH-4518)
lelit Nov 24, 2017
4864a61
bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)
berkerpeksag Nov 24, 2017
9e87e77
bpo-32096: Remove obj and mem from _PyRuntime (#4532)
vstinner Nov 24, 2017
19fb134
bpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)
berkerpeksag Nov 24, 2017
0f86cd3
bpo-28684: asyncio tests handle PermissionError raised on binding uni…
xdegaye Nov 24, 2017
78a5722
Improve the String tutorial docs (GH-4541)
Nov 24, 2017
5742f67
bpo-28684: Remove useless import added by the previous commit (GH-4547)
xdegaye Nov 24, 2017
da9c8c3
bpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544)
vstinner Nov 24, 2017
84c4b19
bpo-32124: Document C functions safe before init (#4540)
vstinner Nov 24, 2017
46972b7
bpo-32030: Add _PyMainInterpreterConfig_ReadEnv() (#4542)
vstinner Nov 24, 2017
f04ebe2
bpo-32030: Add _PyMainInterpreterConfig.program_name (#4548)
vstinner Nov 24, 2017
f8802d8
Asyncion-Dev docs: Fix the reference to sys.excepthook (GH-4414)
ashwoods Nov 24, 2017
706cb31
bpo-32128: Skip test_nntplib.test_article_head_body() (#4552)
vstinner Nov 25, 2017
9316ee4
bpo-32030: Add _PyPathConfig_Init() (#4551)
vstinner Nov 25, 2017
610e5af
bpo-30004: Fix the code example of using group in Regex Howto Docs (G…
mandeep Nov 25, 2017
9d5ec80
Improve Scheduler Objects documentation. (GH-4556)
Mariatta Nov 25, 2017
8d9bb11
bpo-28334: netrc() now uses expanduser() to find .netrc file (GH-4537)
berkerpeksag Nov 25, 2017
5b48dc6
bpo-32071: Add unittest -k option (#4496)
jonashaag Nov 25, 2017
cfa797c
bpo-24641: Improved error message for JSON unserializible keys. (#4364)
serhiy-storchaka Nov 25, 2017
77f5139
bpo-32059: setup.py now also searches the sysroot paths (GH-4452)
xdegaye Nov 25, 2017
76fdac4
bpo-26856: Skip test_pwd on Android until issue 32033 is fixed (GH-4561)
xdegaye Nov 25, 2017
cef88b9
mark fatal_error as noreturn (#4563)
benjaminp Nov 25, 2017
53efbf3
bpo-11063: Handle uuid.h being in default include path (GH-4565)
ncoghlan Nov 26, 2017
4274609
bpo-32096: Ensure new embedding test can find the encodings module (G…
ncoghlan Nov 26, 2017
a6fba9b
bpo-32126: Skip asyncio test when sem_open() is not functional (GH-4559)
xdegaye Nov 26, 2017
d8d6b91
bpo-30487: automatically create a venv and install Sphinx when runnin…
cjrh Nov 26, 2017
0cd2e81
bpo-29879: Update typing documentation. (GH-4573)
ilevkivskyi Nov 26, 2017
ede2ac9
bpo-23033: Improve SSL Certificate handling (GH-937)
daxlab Nov 26, 2017
c172fc5
bpo-32051: Fix name shadowing in multiprocessing docs (GH-4469)
1a1a11a Nov 27, 2017
21c7730
bpo-32089: Use default action for ResourceWarning (#4584)
vstinner Nov 27, 2017
c975878
bpo-27535: Fix memory leak with warnings ignore (#4489)
vstinner Nov 27, 2017
9522a21
bpo-32107 - Better merge of #4494 (#4576)
warsaw Nov 27, 2017
122fc13
Revert "bpo-30487: automatically create a venv and install Sphinx whe…
ned-deily Nov 27, 2017
39f0bb5
bpo-32136: Separate embedding tests from C API tests (GH-4567)
ncoghlan Nov 27, 2017
c9409f7
Revert "bpo-32107 - Better merge of #4494 (#4576)" (#4593)
vstinner Nov 27, 2017
28e6165
bpo-31245: asyncio: Fix typo, isistance => isinstance (#4594)
vstinner Nov 27, 2017
c16bace
asyncio: Remove unused Future._tb_logger attribute (#4596)
vstinner Nov 27, 2017
92f9339
asyncio: Fix BaseSelectorEventLoopTests (#4595)
vstinner Nov 27, 2017
a10dc3e
asyncio: use directly socket.socketpair() (#4597)
vstinner Nov 28, 2017
3f438a9
asyncio: Remove asyncio/compat.py (#4606)
vstinner Nov 28, 2017
4271dfd
bpo-32154: Remove asyncio.selectors (#4605)
vstinner Nov 28, 2017
696b501
bpo-32155: Bugfixes found by flake8 F841 warnings (#4608)
vstinner Nov 28, 2017
08d2b86
bpo-31440: Changed default module search path for windows
Nov 28, 2017
598ceae
bpo-32150: Expand tabs to spaces in C files. (#4583)
serhiy-storchaka Nov 28, 2017
a489599
bpo-32046: Update 2to3 when converts operator.isCallable(obj). (#4417)
corona10 Nov 28, 2017
4d193bc
bpo-32071: Fix regression and add What's New entry (#4589)
jonashaag Nov 28, 2017
ac577d7
bpo-32154: Remove asyncio.windows_utils.socketpair (#4609)
vstinner Nov 28, 2017
c615be5
Use raw strings in the re module examples. (#4616)
serhiy-storchaka Nov 28, 2017
a4a3020
bpo-32157: Removed explicit quotes around %r and {!r}. (#4582)
serhiy-storchaka Nov 28, 2017
fe2d5ba
bpo-32159: Remove tools for CVS and Subversion (#4615)
vstinner Nov 28, 2017
71bd588
bpo-32155: Revert distutils.config change (#4618)
vstinner Nov 28, 2017
23df2d1
bpo-32107 - Improve MAC address calculation and fix test_uuid.py (#4600)
warsaw Nov 28, 2017
219c2de
bpo-32110: codecs.StreamReader.read(n) now returns not more than n (#…
serhiy-storchaka Nov 28, 2017
fd6f8c5
bpo-32100: Delete unneeded import in idlelib.pathbrowser. (#4626)
terryjreedy Nov 29, 2017
e8f7c78
bpo-30781: Remove unused imports in idlelib.configdialog. (#4627)
terryjreedy Nov 29, 2017
041efd2
bpo-32164: Delete unused file idlelib/tabbedpages.py (#4628)
terryjreedy Nov 29, 2017
cc55e78
bpo-32139: test_strftime does not anymore modify the locale (GH-4569)
xdegaye Nov 29, 2017
ef83806
bpo-32138: Skip on Android test_faulthandler tests that raise SIGSEGV…
xdegaye Nov 29, 2017
c15bb49
test_socket: socket.socketpair() is always available (#4634)
vstinner Nov 29, 2017
5d39e04
bpo-32030: Rework memory allocators (#4625)
vstinner Nov 29, 2017
cc83920
bpo-32166: Drop Python 3.4 code from asyncio (#4612)
asvetlov Nov 29, 2017
859f7ce
bpo-32159: Revert Misc/svnmap.txt (#4639)
vstinner Nov 29, 2017
706e10b
bpo-32121: Add most_recent_first parameter to tracemalloc.Traceback.f…
Jesse-Bakker Nov 29, 2017
5e3806f
bpo-32101: Add PYTHONDEVMODE environment variable (#4624)
vstinner Nov 30, 2017
86afc1f
Skip test_socket.test_sha256() on linux < 4.5 (#4643)
vstinner Nov 30, 2017
0efc024
Fix CID-1414686: PyInit_readline() handles errors (#4647)
vstinner Nov 30, 2017
bc8ac6b
bpo-32030: Fix _Py_InitializeEx_Private() (#4649)
vstinner Nov 30, 2017
986375e
bpo-28416: Break reference cycles in Pickler and Unpickler subclasses…
serhiy-storchaka Nov 30, 2017
b4d1e1f
bpo-20891: Fix PyGILState_Ensure() (#4650)
vstinner Nov 30, 2017
a897aee
bpo-32072: Fix issues with binary plists. (#4455)
serhiy-storchaka Nov 30, 2017
3be3b97
make tags: index also Modules/_ctypes/ (#4648)
vstinner Nov 30, 2017
c319eee
Fix CID-1420310: cast PY_TIMEOUT_MAX to _Py_time_t (#4646)
vstinner Nov 30, 2017
6a89481
bpo-32186: Release the GIL during lseek and fstat (#4652)
nirs Dec 1, 2017
73a7e9b
bpo-10544: Deprecate "yield" in comprehensions and generator expressi…
serhiy-storchaka Dec 1, 2017
a561862
Don't hide unexpected errors in PyErr_WarnExplicitObject(). (#4585)
serhiy-storchaka Dec 1, 2017
bf2b65e
bpo-28668: test.support.requires_multiprocessing_queue is removed (GH…
xdegaye Dec 1, 2017
8f5c28b
Fix asyncio.streams.FlowControlMixin docstring typo. (#4578)
johnchen902 Dec 1, 2017
b64de46
bpo-32030: Cleanup "path config" code (#4663)
vstinner Dec 1, 2017
9ac3d88
bpo-32030: Fix Py_GetPath(): init program_name (#4665)
vstinner Dec 1, 2017
ebac19d
bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)
vstinner Dec 1, 2017
0ea395a
bpo-32030: Add Python/pathconfig.c (#4668)
vstinner Dec 1, 2017
e23c06e
bpo-32030: Fix config_get_program_name() on macOS (#4669)
vstinner Dec 1, 2017
af5a895
bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)
vstinner Dec 2, 2017
13badcb
bpo-32197: Try to fix a compiler error on OS X introduced in bpo-3203…
serhiy-storchaka Dec 2, 2017
1eaa116
Add a minimal unit test for Python/frozen.c. (#2995)
nascheme Dec 2, 2017
7324b5c
bpo-31589 : Build PDF using xelatex for better UTF8 support. (#3940)
JulienPalard Dec 2, 2017
078f181
bpo-32176: Set CO_NOFREE in the code object constructor (GH-4675)
ncoghlan Dec 3, 2017
eea3cc1
Refactor PyImport_ImportModuleLevelObject(). (#4680)
nascheme Dec 3, 2017
1fb72d2
bpo-32137: The repr of deeply nested dict now raises a RecursionError…
serhiy-storchaka Dec 3, 2017
29ba688
bpo-31619: Fixed integer overflow in converting huge strings to int. …
serhiy-storchaka Dec 3, 2017
85d5c18
bpo-27240 Rewrite the email header folding algorithm. (#3488)
bitdancer Dec 3, 2017
e69fbb6
Fix a regression in uuid added in bpo-32107. (#4677)
serhiy-storchaka Dec 4, 2017
70d56fb
bpo-25054, bpo-1647489: Added support of splitting on zerowidth patte…
serhiy-storchaka Dec 4, 2017
31a8393
Revert "bpo-32197: Try to fix a compiler error on OS X introduced in …
vstinner Dec 4, 2017
21255fc
bpo-30928: Update idlelib/NEWS.txt to 2017 Dec 3. (#4701)
terryjreedy Dec 4, 2017
1e2fcac
bpo-32207: Improve tk event exception tracebacks in IDLE. (#4703)
terryjreedy Dec 4, 2017
f0db54a
bpo-32214: Implement PEP 557: Data Classes (#4704)
ericvsmith Dec 4, 2017
2c0c68d
bpo-30928: update idlelib/NEWS.txt. (#4706)
terryjreedy Dec 4, 2017
ca7562a
bpo-28791: Update macOS installer to use SQLite 3.21.0. (#4245)
Mariatta Dec 5, 2017
29bc193
[bpo-28556] Minor fixes for typing module (#4710)
ilevkivskyi Dec 5, 2017
9625bf5
Enable SQLite JSON functions for macOS installer build (#4712)
ned-deily Dec 5, 2017
8837dd0
bpo-19610: Warn if distutils is provided something other than a list …
nascheme Dec 5, 2017
24e0469
bpo-31392: Update macOS installer to use OpenSSL 1.0.2m (#4715)
ned-deily Dec 5, 2017
e6f8a73
Update macOS installer to XZ 5.2.3 (#4718)
ned-deily Dec 5, 2017
b3edde8
bpo-31380: Skip test_httpservers test_undecodable_file on macOS. (#4720)
ned-deily Dec 5, 2017
ae342cf
Add a missing space in tkinter documentation. (GH-4692)
JulienPalard Dec 5, 2017
33c377e
bpo-32030: Simplify _PyCoreConfig_INIT macro (#4728)
vstinner Dec 5, 2017
57f477c
Merge remote-tracking branch 'upstream/master' into base-subclass
ilevkivskyi Dec 5, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
215 changes: 212 additions & 3 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,213 @@
Initialization, Finalization, and Threads
*****************************************

.. _pre-init-safe:

Before Python Initialization
============================

In an application embedding Python, the :c:func:`Py_Initialize` function must
be called before using any other Python/C API functions; with the exception of
a few functions and the :ref:`global configuration variables
<global-conf-vars>`.

The following functions can be safely called before Python is initialized:

* Configuration functions:

* :c:func:`PyImport_AppendInittab`
* :c:func:`PyImport_ExtendInittab`
* :c:func:`PyInitFrozenExtensions`
* :c:func:`PyMem_SetAllocator`
* :c:func:`PyMem_SetupDebugHooks`
* :c:func:`PyObject_SetArenaAllocator`
* :c:func:`Py_SetPath`
* :c:func:`Py_SetProgramName`
* :c:func:`Py_SetPythonHome`
* :c:func:`Py_SetStandardStreamEncoding`

* Informative functions:

* :c:func:`PyMem_GetAllocator`
* :c:func:`PyObject_GetArenaAllocator`
* :c:func:`Py_GetBuildInfo`
* :c:func:`Py_GetCompiler`
* :c:func:`Py_GetCopyright`
* :c:func:`Py_GetPlatform`
* :c:func:`Py_GetVersion`

* Utilities:

* :c:func:`Py_DecodeLocale`

* Memory allocators:

* :c:func:`PyMem_RawMalloc`
* :c:func:`PyMem_RawRealloc`
* :c:func:`PyMem_RawCalloc`
* :c:func:`PyMem_RawFree`

.. note::

The following functions **should not be called** before
:c:func:`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`,
:c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`,
:c:func:`Py_GetProgramName` and :c:func:`PyEval_InitThreads`.


.. _global-conf-vars:

Global configuration variables
==============================

Python has variables for the global configuration to control different features
and options. By default, these flags are controlled by :ref:`command line
options <using-on-interface-options>`.

When a flag is set by an option, the value of the flag is the number of times
that the option was set. For example, ``-b`` sets :c:data:`Py_BytesWarningFlag`
to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

.. c:var:: Py_BytesWarningFlag

Issue a warning when comparing :class:`bytes` or :class:`bytearray` with
:class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater
or equal to ``2``.

Set by the :option:`-b` option.

.. c:var:: Py_DebugFlag

Turn on parser debugging output (for expert only, depending on compilation
options).

Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment
variable.

.. c:var:: Py_DontWriteBytecodeFlag

If set to non-zero, Python won't try to write ``.pyc`` files on the
import of source modules.

Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE`
environment variable.

.. c:var:: Py_FrozenFlag

Suppress error messages when calculating the module search path in
:c:func:`Py_GetPath`.

Private flag used by ``_freeze_importlib`` and ``frozenmain`` programs.

.. c:var:: Py_HashRandomizationFlag

Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to
a non-empty string.

If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment
variable to initialize the secret hash seed.

.. c:var:: Py_IgnoreEnvironmentFlag

Ignore all :envvar:`PYTHON*` environment variables, e.g.
:envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set.

Set by the :option:`-E` and :option:`-I` options.

.. c:var:: Py_InspectFlag

When a script is passed as first argument or the :option:`-c` option is used,
enter interactive mode after executing the script or the command, even when
:data:`sys.stdin` does not appear to be a terminal.

Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment
variable.

.. c:var:: Py_InteractiveFlag

Set by the :option:`-i` option.

.. c:var:: Py_IsolatedFlag

Run Python in isolated mode. In isolated mode :data:`sys.path` contains
neither the script's directory nor the user's site-packages directory.

Set by the :option:`-I` option.

.. versionadded:: 3.4

.. c:var:: Py_LegacyWindowsFSEncodingFlag

If the flag is non-zero, use the ``mbcs`` encoding instead of the UTF-8
encoding for the filesystem encoding.

Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment
variable is set to a non-empty string.

See :pep:`529` for more details.

Availability: Windows.

.. c:var:: Py_LegacyWindowsStdioFlag

If the flag is non-zero, use :class:`io.FileIO` instead of
:class:`WindowsConsoleIO` for :mod:`sys` standard streams.

Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment
variable is set to a non-empty string.

See :pep:`528` for more details.

Availability: Windows.

.. c:var:: Py_NoSiteFlag

Disable the import of the module :mod:`site` and the site-dependent
manipulations of :data:`sys.path` that it entails. Also disable these
manipulations if :mod:`site` is explicitly imported later (call
:func:`site.main` if you want them to be triggered).

Set by the :option:`-S` option.

.. c:var:: Py_NoUserSiteDirectory

Don't add the :data:`user site-packages directory <site.USER_SITE>` to
:data:`sys.path`.

Set by the :option:`-s` and :option:`-I` options, and the
:envvar:`PYTHONNOUSERSITE` environment variable.

.. c:var:: Py_OptimizeFlag

Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment
variable.

.. c:var:: Py_QuietFlag

Don't display the copyright and version messages even in interactive mode.

Set by the :option:`-q` option.

.. versionadded:: 3.2

.. c:var:: Py_UnbufferedStdioFlag

Force the stdout and stderr streams to be unbuffered.

Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED`
environment variable.

.. c:var:: Py_VerboseFlag

Print a message each time a module is initialized, showing the place
(filename or built-in module) from which it is loaded. If greater or equal
to ``2``, print a message for each file that is checked for when
searching for a module. Also provides information on module cleanup at exit.

Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment
variable.


Initializing and finalizing the interpreter
===========================================
Expand All @@ -27,9 +234,11 @@ Initializing and finalizing the interpreter
single: PySys_SetArgvEx()
single: Py_FinalizeEx()

Initialize the Python interpreter. In an application embedding Python, this
should be called before using any other Python/C API functions; with the
exception of :c:func:`Py_SetProgramName`, :c:func:`Py_SetPythonHome` and :c:func:`Py_SetPath`. This initializes
Initialize the Python interpreter. In an application embedding Python,
this should be called before using any other Python/C API functions; see
:ref:`Before Python Initialization <pre-init-safe>` for the few exceptions.

This initializes
the table of loaded modules (``sys.modules``), and creates the fundamental
modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes
the module search path (``sys.path``). It does not set ``sys.argv``; use
Expand Down
47 changes: 38 additions & 9 deletions Doc/c-api/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ The following function sets are wrappers to the system allocator. These
functions are thread-safe, the :term:`GIL <global interpreter lock>` does not
need to be held.

The default raw memory block allocator uses the following functions:
:c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`; call
``malloc(1)`` (or ``calloc(1, 1)``) when requesting zero bytes.
The :ref:`default raw memory allocator <default-memory-allocators>` uses
the following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc`
and :c:func:`free`; call ``malloc(1)`` (or ``calloc(1, 1)``) when requesting
zero bytes.

.. versionadded:: 3.4

Expand Down Expand Up @@ -165,7 +166,8 @@ The following function sets, modeled after the ANSI C standard, but specifying
behavior when requesting zero bytes, are available for allocating and releasing
memory from the Python heap.

By default, these functions use :ref:`pymalloc memory allocator <pymalloc>`.
The :ref:`default memory allocator <default-memory-allocators>` uses the
:ref:`pymalloc memory allocator <pymalloc>`.

.. warning::

Expand Down Expand Up @@ -270,7 +272,8 @@ The following function sets, modeled after the ANSI C standard, but specifying
behavior when requesting zero bytes, are available for allocating and releasing
memory from the Python heap.

By default, these functions use :ref:`pymalloc memory allocator <pymalloc>`.
The :ref:`default object allocator <default-memory-allocators>` uses the
:ref:`pymalloc memory allocator <pymalloc>`.

.. warning::

Expand Down Expand Up @@ -326,6 +329,31 @@ By default, these functions use :ref:`pymalloc memory allocator <pymalloc>`.
If *p* is *NULL*, no operation is performed.


.. _default-memory-allocators:

Default Memory Allocators
=========================

Default memory allocators:

=============================== ==================== ================== ===================== ====================
Configuration Name PyMem_RawMalloc PyMem_Malloc PyObject_Malloc
=============================== ==================== ================== ===================== ====================
Release build ``"pymalloc"`` ``malloc`` ``pymalloc`` ``pymalloc``
Debug build ``"pymalloc_debug"`` ``malloc`` + debug ``pymalloc`` + debug ``pymalloc`` + debug
Release build, without pymalloc ``"malloc"`` ``malloc`` ``malloc`` ``malloc``
Release build, without pymalloc ``"malloc_debug"`` ``malloc`` + debug ``malloc`` + debug ``malloc`` + debug
=============================== ==================== ================== ===================== ====================

Legend:

* Name: value for :envvar:`PYTHONMALLOC` environment variable
* ``malloc``: system allocators from the standard C library, C functions:
:c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`
* ``pymalloc``: :ref:`pymalloc memory allocator <pymalloc>`
* "+ debug": with debug hooks installed by :c:func:`PyMem_SetupDebugHooks`


Customize Memory Allocators
===========================

Expand Down Expand Up @@ -431,7 +459,8 @@ Customize Memory Allocators
displayed if :mod:`tracemalloc` is tracing Python memory allocations and the
memory block was traced.

These hooks are installed by default if Python is compiled in debug
These hooks are :ref:`installed by default <default-memory-allocators>` if
Python is compiled in debug
mode. The :envvar:`PYTHONMALLOC` environment variable can be used to install
debug hooks on a Python compiled in release mode.

Expand All @@ -453,9 +482,9 @@ to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
with a fixed size of 256 KiB. It falls back to :c:func:`PyMem_RawMalloc` and
:c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes.

*pymalloc* is the default allocator of the :c:data:`PYMEM_DOMAIN_MEM` (ex:
:c:func:`PyMem_Malloc`) and :c:data:`PYMEM_DOMAIN_OBJ` (ex:
:c:func:`PyObject_Malloc`) domains.
*pymalloc* is the :ref:`default allocator <default-memory-allocators>` of the
:c:data:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and
:c:data:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains.

The arena allocator uses the following functions:

Expand Down
3 changes: 2 additions & 1 deletion Doc/c-api/veryhigh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ the same library that the Python runtime is using.
Read and execute statements from a file associated with an interactive device
until EOF is reached. The user will be prompted using ``sys.ps1`` and
``sys.ps2``. *filename* is decoded from the filesystem encoding
(:func:`sys.getfilesystemencoding`). Returns ``0`` at EOF.
(:func:`sys.getfilesystemencoding`). Returns ``0`` at EOF or a negative
number upon failure.


.. c:var:: int (*PyOS_InputHook)(void)
Expand Down
5 changes: 2 additions & 3 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@
# Options for LaTeX output
# ------------------------

latex_engine = 'xelatex'

# Get LaTeX to handle Unicode correctly
latex_elements = {
'inputenc': r'\usepackage[utf8x]{inputenc}',
'utf8extra': '',
'fontenc': r'\usepackage[T1,T2A]{fontenc}',
}

# Additional stuff for the LaTeX preamble.
Expand Down
4 changes: 4 additions & 0 deletions Doc/distutils/apiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ the full reference.
See the :func:`setup` function for a list of keyword arguments accepted by the
Distribution constructor. :func:`setup` creates a Distribution instance.

.. versionchanged:: 3.7
:class:`~distutils.core.Distribution` now warns if ``classifiers``,
``keywords`` and ``platforms`` fields are not specified as a list or
a string.

.. class:: Command

Expand Down
Loading