summaryrefslogtreecommitdiffstats
path: root/Doc
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39351: Remove base64.encodestring() (GH-18022)Victor Stinner2020-01-162-12/+5
| | | | | Remove base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1: use base64.encodebytes() and base64.decodebytes() instead.
* bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)Oz N Tiram2020-01-151-1/+3
| | | | | | | | | | | The previous double colon was wrongly place directly after Therefore. Which produced a block without syntax highlighting. This fixes it by separating the double colon from the text. As a result, sphinx now properly highlights the python code. https://bugs.python.org/issue39348
* bpo-37958: Adding get_profile_dict to pstats (GH-15495)Daniel Olshansky2020-01-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pstats is really useful or profiling and printing the output of the execution of some block of code, but I've found on multiple occasions when I'd like to access this output directly in an easily usable dictionary on which I can further analyze or manipulate. The proposal is to add a function called get_profile_dict inside of pstats that'll automatically return this data the data in an easily accessible dict. The output of the following script: ``` import cProfile, pstats import pprint from pstats import func_std_string, f8 def fib(n): if n == 0: return 0 if n == 1: return 1 return fib(n-1) + fib(n-2) pr = cProfile.Profile() pr.enable() fib(5) pr.create_stats() ps = pstats.Stats(pr).sort_stats('tottime', 'cumtime') def get_profile_dict(self, keys_filter=None): """ Returns a dict where the key is a function name and the value is a dict with the following keys: - ncalls - tottime - percall_tottime - cumtime - percall_cumtime - file_name - line_number keys_filter can be optionally set to limit the key-value pairs in the retrieved dict. """ pstats_dict = {} func_list = self.fcn_list[:] if self.fcn_list else list(self.stats.keys()) if not func_list: return pstats_dict pstats_dict["total_tt"] = float(f8(self.total_tt)) for func in func_list: cc, nc, tt, ct, callers = self.stats[func] file, line, func_name = func ncalls = str(nc) if nc == cc else (str(nc) + '/' + str(cc)) tottime = float(f8(tt)) percall_tottime = -1 if nc == 0 else float(f8(tt/nc)) cumtime = float(f8(ct)) percall_cumtime = -1 if cc == 0 else float(f8(ct/cc)) func_dict = { "ncalls": ncalls, "tottime": tottime, # time spent in this function alone "percall_tottime": percall_tottime, "cumtime": cumtime, # time spent in the function plus all functions that this function called, "percall_cumtime": percall_cumtime, "file_name": file, "line_number": line } func_dict_filtered = func_dict if not keys_filter else { key: func_dict[key] for key in keys_filter } pstats_dict[func_name] = func_dict_filtered return pstats_dict pp = pprint.PrettyPrinter(depth=6) pp.pprint(get_profile_dict(ps)) ``` will produce: ``` {"<method 'disable' of '_lsprof.Profiler' objects>": {'cumtime': 0.0, 'file_name': '~', 'line_number': 0, 'ncalls': '1', 'percall_cumtime': 0.0, 'percall_tottime': 0.0, 'tottime': 0.0}, 'create_stats': {'cumtime': 0.0, 'file_name': '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cProfile.py', 'line_number': 50, 'ncalls': '1', 'percall_cumtime': 0.0, 'percall_tottime': 0.0, 'tottime': 0.0}, 'fib': {'cumtime': 0.0, 'file_name': 'get_profile_dict.py', 'line_number': 5, 'ncalls': '15/1', 'percall_cumtime': 0.0, 'percall_tottime': 0.0, 'tottime': 0.0}, 'total_tt': 0.0} ``` As an example, this can be used to generate a stacked column chart using various visualization tools which will assist in easily identifying program bottlenecks. https://bugs.python.org/issue37958 Automerge-Triggered-By: @gpshead
* Fix typo in multiprocessing.pool.AsyncResult.successful doc. (GH-17932)Antoine2020-01-151-1/+1
| | | | | | | | Since 3.7 `successful` raises a `ValueError` as explained in the next text block from the documentation: _Changed in version 3.7: If the result is not ready, ValueError is raised instead of AssertionError._ No issue associated with this PR. Should be backported in 3.7 and 3.8.
* bpo-38630: Fix subprocess.Popen.send_signal() race condition (GH-16984)Victor Stinner2020-01-151-0/+2
| | | | | | | On Unix, subprocess.Popen.send_signal() now polls the process status. Polling reduces the risk of sending a signal to the wrong process if the process completed, the Popen.returncode attribute is still None, and the pid has been reassigned (recycled) to a new different process.
* Fix AsyncMock base class in the docs (GH-18008)Elena Oat2020-01-151-1/+1
|
* bpo-39329: Add timeout parameter for smtplib.LMTP constructor (GH-17998)Dong-hee Na2020-01-142-1/+8
|
* bpo-38901: Allow setting a venv's prompt to the basename of the current ↵Vinay Sajip2020-01-141-1/+2
| | | | | | directory. (GH-17946) When a prompt value of '.' is specified, os.path.basename(os.getcwd()) is used to configure the prompt for the created venv.
* Fix documentation in code.py (GH-17988)Kyle Pollina2020-01-141-1/+1
|
* bpo-39322: Add gc.is_finalized to check if an object has been finalised by ↵Pablo Galindo2020-01-142-0/+25
| | | | the gc (GH-17989)
* bpo-39048: Look up __aenter__ before __aexit__ in async with (GH-17609)Géry Ogam2020-01-141-1/+1
| | | | | | * Reorder the __aenter__ and __aexit__ checks for async with * Add assertions for async with body being skipped * Swap __aexit__ and __aenter__ loading in the documentation
* bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)Mark Shannon2020-01-141-0/+21
| | | | | | | | Break up COMPARE_OP into four logically distinct opcodes: * COMPARE_OP for rich comparisons * IS_OP for 'is' and 'is not' tests * CONTAINS_OP for 'in' and 'is not' tests * JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
* bpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 (GH-17958)Dong-hee Na2020-01-142-0/+13
|
* bpo-39259: ftplib.FTP/FTP_TLS now reject timeout = 0 (GH-17959)Dong-hee Na2020-01-132-0/+14
|
* bpo-20443: Update What's New In Python 3.9 (GH-17986)Victor Stinner2020-01-131-1/+1
| | | The sys.argv[0] change has been reverted.
* bpo-39310: Add math.ulp(x) (GH-17965)Victor Stinner2020-01-133-8/+44
| | | | Add math.ulp(): return the value of the least significant bit of a float.
* bpo-39313: Add an option to RefactoringTool for using exec as a function ↵Batuhan Taşkaya2020-01-121-1/+1
| | | | | | | | (GH-17967) https://bugs.python.org/issue39313 Automerge-Triggered-By: @pablogsal
* bpo-3530: Add advice on when to correctly use fix_missing_locations in the ↵Batuhan Taşkaya2020-01-121-1/+9
| | | | | | AST docs (GH-17172) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39288: Add examples to math.nextafter() documentation (GH-17962)Victor Stinner2020-01-121-0/+7
|
* bpo-12159: Document sys.maxsize limit in len() function reference (GH-17934)Zac Hatfield-Dodds2020-01-121-0/+5
|
* bpo-39288: Add math.nextafter(x, y) (GH-17937)Victor Stinner2020-01-122-0/+15
| | | Return the next floating-point value after x towards y.
* bpo-39259: nntplib.NNTP/NNTP_SSL now reject timeout = 0 (GH-17936)Dong-hee Na2020-01-112-0/+15
| | | | | nntplib.NNTP and nntplib.NNTP_SSL now raise a ValueError if the given timeout for their constructor is zero to prevent the creation of a non-blocking socket.
* bpo-39259: poplib now rejects timeout = 0 (GH-17912)Dong-hee Na2020-01-102-1/+14
| | | | | poplib.POP3 and poplib.POP3_SSL now raise a ValueError if the given timeout for their constructor is zero to prevent the creation of a non-blocking socket.
* bpo-39161: Document multi-phase init modules under Py_NewInterpreter() ↵Petr Viktorin2020-01-091-17/+35
| | | | | | | | | (GH-17896) \+ this also adds a stronger warning against sharing objects between (sub-)interpreters. https://bugs.python.org/issue39161
* bpo-35292: Avoid calling mimetypes.init when http.server is imported (GH-17822)An Long2020-01-081-3/+6
|
* bpo-39242: Updated the Gmane domain into news.gmane.io (GH-17903)Dong-hee Na2020-01-081-4/+4
|
* bpo-39233: Update positional-only section in the glossary (GH-17874)Pablo Galindo2020-01-081-3/+5
| | | https://bugs.python.org/issue39233
* bpo-38615: Add timeout parameter for IMAP4 and IMAP4_SSL constructor (GH-17203)Dong-hee Na2020-01-072-10/+37
| | | | | | | | imaplib.IMAP4 and imaplib.IMAP4_SSL now have an optional *timeout* parameter for their constructors. Also, the imaplib.IMAP4.open() method now has an optional *timeout* parameter with this change. The overridden methods of imaplib.IMAP4_SSL and imaplib.IMAP4_stream were applied to this change.
* bpo-39239: epoll.unregister() no longer ignores EBADF (GH-17882)Victor Stinner2020-01-072-0/+7
| | | | The select.epoll.unregister() method no longer ignores the EBADF error.
* bpo-38623: Doc: Add section for site module CLI. (GH-17858)Inada Naoki2020-01-071-2/+7
|
* Doc: Change Python 2 status to EOL. (GH-17885)Inada Naoki2020-01-071-1/+1
|
* bpo-39234: `enum.auto()` default initial value as 1 (GH-17878)YoSTEALTH2020-01-061-1/+1
| | | | | | | | | | Updated as Eric mentioned "By default, the initial value starts at 1" https://bugs.python.org/issue39234 Automerge-Triggered-By: @ericvsmith
* bpo-39234: Doc: `enum.auto()` incrementation value not specified. (GH-17872)YoSTEALTH2020-01-061-1/+1
| | | * `enum.auto()` initial value is now specified as being `1`.
* Minor formatting improvements and fixes to idle.rst (GH-17165)Tal Einat2020-01-051-7/+8
|
* bpo-39130: Dict reversed was added in v3.8 so should say in the doc as well ↵Khalid Mammadov2020-01-051-0/+2
| | | | | | | | | (GH-17694) To be consistent with document layout, it should say when the feature was added. Although it's mentioned few other places in the doc but it's not explicitly say that at that place. https://bugs.python.org/issue39130
* Fix the parameter list of object. _rpow_ (#GH-16477)HongWeipeng2020-01-051-1/+1
|
* Replace links in howto/pyporting.rst with sphinx references (GH-17781)Oleg Höfling2020-01-051-7/+3
| | | Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com>
* Add link to zlib v1.1.3 vulnerability (GH-17156)Emmanuel Nosa E2020-01-031-3/+2
|
* bpo-39158: ast.literal_eval() doesn't support empty sets (GH-17742)Raymond Hettinger2020-01-031-0/+3
|
* Bring Python into the next decade. (GH-17801)Benjamin Peterson2020-01-032-2/+2
|
* bpo-39183: Fix formatting in library/ensurepip (GH-17787)Rafael Fontenelle2020-01-011-1/+1
| | | | | | Remove extra space to fix formatting and avoid from splitting text in to strings. https://bugs.python.org/issue39183
* bpo-13601: always use line-buffering for sys.stderr (GH-17646)Jendrik Seipp2020-01-011-3/+9
|
* Document CodeType.replace (GH-17776)Anthony Sottile2020-01-011-1/+7
|
* Minor doc fixes in urllib.parse (GH-17745)Борис Верховский2019-12-311-26/+27
|
* bpo-34118: memoryview, range, and tuple are classes (GH-17761)Terry Jan Reedy2019-12-301-3/+3
| | | | Tag memoryview, range, and tuple as classes, the same as list, etcetera, in the library manual built-in functions list.
* bpo-34790: Implement deprecation of passing coroutines to asyncio.wait() ↵Kyle Stanley2019-12-301-0/+3
| | | | (GH-16977)
* bpo-39037: Fix lookup order of magic methods in with statement documentation ↵Géry Ogam2019-12-301-18/+49
| | | | | | | | | | (GH-17608) * __enter__ is now looked up before __exit__ to give a more intuitive error message * add pseudo-code equivalent for the with statement * fix pseudo-code for the async with statement to use a finally clause * use SUITE rather than BLOCK for consistency with the language grammar Patch by Géry Ogam.
* Fix typos and remove deprecated deprecation warning. (GH-17741)Antoine2019-12-291-11/+4
|
* links in importlib.metadata.rst replaced with sphinx references (GH-17730)Oleg Höfling2019-12-292-23/+18
| | | | | | | The importlib.metadata documentation uses hardcoded links to internal pages. This results in minor rendering issues. This change replaces the hardcoded links with suitable Sphinx roles. Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com>
* bpo-39136: Fixed typos (GH-17720)Gurupad Hegde2019-12-286-6/+6
| | | | | funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape,