Commit Graph

1004 Commits

Author SHA1 Message Date
Serhiy Storchaka 21d9f10c94 Merge from 3.5. 2016-10-08 22:46:01 +03:00
Serhiy Storchaka 9c0e1f83af Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters().
Patch by Xiang Zhang.
2016-10-08 22:45:38 +03:00
Serhiy Storchaka e45b7c09ec Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
Original patch by Niklas Koep.
2016-10-07 23:25:46 +03:00
Serhiy Storchaka de0574bdab Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
Original patch by Niklas Koep.
2016-10-07 23:24:35 +03:00
Serhiy Storchaka b3648576cd Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:30:35 +03:00
Serhiy Storchaka cc164232aa Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:29:26 +03:00
Berker Peksag db83f72a7f Issue #27740: Merge from 3.5 2016-09-28 19:35:55 +03:00
Berker Peksag ab39b09958 Issue #27740: Fix typo in Py_CompileStringExFlags 2016-09-28 19:35:25 +03:00
Serhiy Storchaka 4781b59185 Issues #25909, #28211: Restored correct documentation of PyMapping_Items,
PyMapping_Keys and PyMapping_Values.  Based on patch by Xiang Zhang.
2016-09-26 20:53:27 +03:00
Serhiy Storchaka 1d480bea9c Issues #25909, #28211: Restored correct documentation of PyMapping_Items,
PyMapping_Keys and PyMapping_Values.  Based on patch by Xiang Zhang.
2016-09-26 20:52:41 +03:00
Berker Peksag 7b4bcd2004 Issue #25270: Merge from 3.5 2016-09-16 17:32:06 +03:00
Berker Peksag 4a72a7b6c4 Issue #25270: Prevent codecs.escape_encode() from raising SystemError when an empty bytestring is passed 2016-09-16 17:31:06 +03:00
Steve Dower de02b084e6 Closes #22731: Documents change of console mode. 2016-09-09 11:46:37 -07:00
Steve Dower 8b26702fa3 Closes #22731: Documents change of console mode. 2016-09-09 11:47:02 -07:00
Senthil Kumaran 32d374215a [backport to 3.5] - issue26896 - Disambiguate uses of "importer" with "finder". 2016-09-07 00:52:20 -07:00
Steve Dower cc16be85c0 Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) 2016-09-08 10:35:16 -07:00
Benjamin Peterson 47ff0734b8 more PY_LONG_LONG to long long 2016-09-08 09:15:54 -07:00
Eric Snow 46f97b85a8 Issue #15767: Use ModuleNotFoundError. 2016-09-07 16:56:15 -07:00
Eric Snow c943265ba5 Issue #15767: Add ModuleNotFoundError. 2016-09-07 15:42:32 -07:00
Brett Cannon a571120410 Issue #27182: Add support for path-like objects to PyUnicode_FSDecoder(). 2016-09-06 19:36:01 -07:00
Brett Cannon ec6ce879c7 Issue #26027: Support path-like objects in PyUnicode-FSConverter().
This is to add support for os.exec*() and os.spawn*() functions. Part
of PEP 519.
2016-09-06 15:50:29 -07:00
Benjamin Peterson ed4aa83ff7 require a long long data type (closes #27961) 2016-09-05 17:44:18 -07:00
Nick Coghlan cbcd221de4 Merge #27782 fix from 3.5 2016-08-21 17:43:58 +10:00
Nick Coghlan 8682f578c1 Issue #27782: Fix m_methods handling in multiphase init
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.
2016-08-21 17:41:56 +10:00
Berker Peksag 7a01508bbe Issue #12946: Merge from 3.5 2016-08-19 11:52:08 +03:00
Berker Peksag c01e766b54 Issue #12946: Document that PyModule_GetDict can fail in some cases 2016-08-19 11:51:39 +03:00
Berker Peksag 0b9e64122b Issue #24637: Merge from 3.5 2016-08-13 05:38:18 +03:00
Berker Peksag bd664357f1 Issue #24637: Document that locals can be any mapping object
This behavior is already tested in test_general_eval in
Lib/test/test_builtin.py

Patch by Matthew Keeter.
2016-08-13 05:37:49 +03:00
Martin Panter 0de01c4b30 Issue #24278: Merge argument parsing docs from 3.5 2016-08-04 01:51:32 +00:00
Martin Panter 6c7d5a2553 Issue #24278: Explain how argument parsing output buffers are managed 2016-08-03 14:35:05 +00:00
Serhiy Storchaka b133bb4977 Issue #27481: Docummented that ValueError is now raised instead of TypeError
in case of embedded null characters/bytes.  Patch by Xiang Zhang.
2016-07-12 09:15:00 +03:00
Serhiy Storchaka 6f379f4886 Issue #27481: Docummented that ValueError is now raised instead of TypeError
in case of embedded null characters/bytes.  Patch by Xiang Zhang.
2016-07-12 09:14:15 +03:00
Brett Cannon fdcdd9ed80 Issue #26896: Disambiguate uses of "importer" with "finder".
Thanks to Oren Milman for the patch.
2016-07-08 11:00:00 -07:00
Berker Peksag e3c1d34c65 Merge from 3.5 2016-07-05 17:08:52 +03:00
Berker Peksag e75ffa965b Add versionadded to PyDict_SetDefault documentation
It was added for Python 3.4 in a0b750ea3397.
2016-07-05 17:08:29 +03:00
Brett Cannon c78ca1e044 Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return
type of __fspath__().

As part of this change, also make sure that the pure Python
implementation of os.fspath() is tested.
2016-06-24 12:03:43 -07:00
Martin Panter 2fec611a70 Issue #24314: Merge doc links from 3.5 2016-06-18 08:20:22 +00:00
Martin Panter bae5d81f5d Issue #24314: Fix doc links for general attributes like __name__, __dict__ 2016-06-18 03:57:31 +00:00
Berker Peksag 8f95e65e5d Issue #15657: Delete incorrect statement from PyMethodDef documentation 2016-06-12 16:34:38 +03:00
Serhiy Storchaka f41b82fb19 Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now support
positional-only and keyword parameters in the same function.
2016-06-09 16:30:29 +03:00
Brett Cannon a0053bebc2 Merge 2016-06-09 16:59:13 -07:00
Brett Cannon 746102bd23 Issue #27186: Document PyOS_FSPath(). 2016-06-09 16:58:38 -07:00
Martin Panter 5848ac2df0 Issue #15476: Merge index entries from 3.5 2016-06-09 23:36:40 +00:00
Tommy Beadle e9b8403a1f [Issue 15476] Make "code object" its own entry in the index 2016-06-02 19:26:51 -04:00
Benjamin Peterson 010bb99432 merge 3.5 2016-06-02 11:36:16 -07:00
Benjamin Peterson a49ccf2113 note that Py_VISIT handles NULL (closes #27183) 2016-06-02 11:35:59 -07:00
Martin Panter e514093a2f Issue #27125: Merge typo fixes from 3.5 2016-05-30 05:24:49 +00:00
Martin Panter a90a4a9651 Issue #27125: Remove duplicated words from documentation and comments 2016-05-30 04:04:50 +00:00
Martin Panter 4dd27f0adc Issue #25533: Merge frozen module docs from 3.5 2016-05-15 00:41:40 +00:00
Martin Panter f47a400347 Issue #25533: Update documentation regarding the frozen modules table
* "ctypes" documentation was using Python 2 bytes-str equivalence.
* PyImport_FrozenModules is a pointer to const as of Python 3.4
2016-05-15 00:13:04 +00:00
Benjamin Peterson a4dfbe608f merge 3.5 (#26986) 2016-05-09 23:44:30 -07:00
Benjamin Peterson 387235085c improve PyFunction_New docs (closes #26986)
Patch from Xiang Zhang.
2016-05-09 23:43:53 -07:00
Serhiy Storchaka 1acbf853c8 Issue #26736: Used HTTPS for external links in the documentation if possible. 2016-05-07 10:49:58 +03:00
Serhiy Storchaka 6dff0205b7 Issue #26736: Used HTTPS for external links in the documentation if possible. 2016-05-07 10:49:07 +03:00
Berker Peksag 78de0b1047 Issue #18353: Remove PyUnicode_WRITE_CHAR macro link from c-api/unicode.rst
Patch by Corey Brune.
2016-04-24 03:07:03 +03:00
Berker Peksag 544ae59b8e Issue #18353: Remove PyUnicode_WRITE_CHAR macro link from c-api/unicode.rst
Patch by Corey Brune.
2016-04-24 03:06:44 +03:00
Victor Stinner f5c4b99034 PyMem_Malloc() now uses the fast pymalloc allocator
Issue #26249: PyMem_Malloc() allocator family now uses the pymalloc allocator
rather than system malloc(). Applications calling PyMem_Malloc() without
holding the GIL can now crash: use PYTHONMALLOC=debug environment variable to
validate the usage of memory allocators in your application.
2016-04-22 16:26:23 +02:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Brett Cannon 1f8a1cc0f7 Merge for issue #26760 2016-04-15 12:44:09 -07:00
Brett Cannon abf797df66 Issue #26760: Minimally document PyFrameObject 2016-04-15 12:43:50 -07:00
Martin Panter cda80940ed Issue #15984: Merge PyUnicode doc from 3.5 2016-04-15 02:27:11 +00:00
Martin Panter 20d325574e Issue #15984: Correct PyUnicode_FromObject() and _FromEncodedObject() docs 2016-04-15 00:56:21 +00:00
Martin Panter 6245cb3c01 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Victor Stinner d1700a9360 Fix typo in doc: avoid the french "& cie" :-) 2016-03-23 16:57:51 +01:00
Victor Stinner 914cde89d4 On ResourceWarning, log traceback where the object was allocated
Issue #26567:

* Add a new function PyErr_ResourceWarning() function to pass the destroyed
  object
* Add a source attribute to warnings.WarningMessage
* Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where
  source object was allocated.
2016-03-19 01:03:51 +01:00
Victor Stinner 9b46a57302 Doc: fix typos, patch written by Stefan Behnel 2016-03-18 15:10:43 +01:00
Victor Stinner c2fc56836f Enhance documentation on malloc debug hooks
Issue #26564, #26516, #26563.
2016-03-18 11:04:31 +01:00
Victor Stinner 0611c26a58 On memory error, dump the memory block traceback
Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a
memory block was allocated on memory block. Use the tracemalloc module to get
the traceback.
2016-03-15 22:22:13 +01:00
Victor Stinner c4aec3628b Check the GIL in PyObject_Malloc()
Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is
held when the function is called.
2016-03-14 22:26:53 +01:00
Victor Stinner 34be807ca4 Add PYTHONMALLOC env var
Issue #26516:

* Add PYTHONMALLOC environment variable to set the Python memory
  allocators and/or install debug hooks.
* PyMem_SetupDebugHooks() can now also be used on Python compiled in release
  mode.
* The PYTHONMALLOCSTATS environment variable can now also be used on Python
  compiled in release mode. It now has no effect if set to an empty string.
* In debug mode, debug hooks are now also installed on Python memory allocators
  when Python is configured without pymalloc.
2016-03-14 12:04:26 +01:00
Victor Stinner f915e0e393 Merge 3.5 (malloc doc) 2016-03-09 15:02:31 +01:00
Victor Stinner 29bf27fe7f Issue #26516: Enhance Python mem allocators doc
* add link to PYTHONMALLOCSTATS env var
* add parameters to PyMem macros like PyMem_MALLOC()
* fix PyMem_SetupDebugHooks(): add Calloc functions
* add some newlines for readability
2016-03-09 14:49:52 +01:00
Martin Panter 8cacc63002 Issue #22836: Merge exception reporting from 3.5 2016-02-28 03:29:51 +00:00
Martin Panter 3263f6874a Issue #22836: Keep exception reports sensible despite errors 2016-02-28 03:16:11 +00:00
Serhiy Storchaka 885bdc4946 Issue #25985: sys.version_info is now used instead of sys.version
to format short Python version.
2016-02-11 13:10:36 +02:00
Martin Panter 3008b1c4bb Issue #26304: Merge doc wording from 3.5 2016-02-10 05:44:56 +00:00
Martin Panter c04fb56e36 Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similar
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Serhiy Storchaka c4b813d05d Issue #26198: Fixed error messages for some argument parsing errors.
Fixed the documented about buffer overflow error for "es#" and "et#" format
units.
2016-02-08 01:06:11 +02:00
Berker Peksag 68df686954 Add a link to PEP 384 in stable.rst 2016-01-28 12:42:45 +02:00
Berker Peksag 806cb0f2b6 Add a link to PEP 384 in stable.rst 2016-01-28 12:42:26 +02:00
Senthil Kumaran dce4ae8ffe merge from 3.5
issue25909 - Correct the documentation of PyMapping_Items, PyMapping_Keys and
PyMapping_Values in Include/abstract.h and Doc/c-api/mapping.rst.

Patch contributed by Sonali Gupta.
2016-01-21 09:38:02 -08:00
Senthil Kumaran 1538b3d3df issue25909 - Correct the documentation of PyMapping_Items, PyMapping_Keys and
PyMapping_Values in Include/abstract.h and Doc/c-api/mapping.rst.

Patch contributed by Sonali Gupta.
2016-01-21 09:37:28 -08:00
Brett Cannon 4a4ca7c13f Merge for issue #12484 2015-12-27 12:24:36 -08:00
Brett Cannon 762d5ea875 Issue #12484: Remove a mention of Py_InitModule() and _PyImport_FixupExtension().
Thanks to Alejandro Santos for the bug report and Anish Shah for the
patch.
2015-12-27 12:24:06 -08:00
Martin Panter e7ceef66dd Issue #25701: Merge set and delete documentation from 3.5 2015-12-08 00:05:06 +00:00
Martin Panter 45be8d67be Issue #25701: Document C API functions that both set and delete objects
Also document that the separate functions that delete objects are preferred;
using PyObject_SetAttr(), _SetAttrString(), and PySequence_SetItem() to
delete is deprecated.
2015-12-08 00:03:20 +00:00
Martin Panter b4ce1fc31b Issue #5319: New Py_FinalizeEx() API to exit with status 120 on failure 2015-11-30 03:18:29 +00:00
Serhiy Storchaka 1f847659f3 Issue #25706: Fixed markup in the documentation. 2015-11-23 16:43:54 +02:00
Serhiy Storchaka bf7b9ede1a Issue #25706: Fixed markup in the documentation. 2015-11-23 16:43:05 +02:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Martin Panter 84835ab1cb Issue #25161: Merge full stops from 3.4 into 3.5 2015-10-10 10:44:25 +00:00
Martin Panter d21e0b52f1 Issue #25161: Add full stops in documentation; patch by Takase Arihiro 2015-10-10 10:36:22 +00:00
Martin Panter 36f22a2820 Issue #24808: Merge 3.4 into 3.5; adjust new tp_as_async field 2015-08-25 05:25:21 +00:00
Martin Panter 78d5033337 Issue #24808: Update the documentation of some PyTypeObject fields
Patch by Joseph Weston.
2015-08-25 05:06:39 +00:00
Benjamin Peterson 8e205f7b4f merge 3.4 (#24883) 2015-08-17 23:38:46 -07:00
Benjamin Peterson 2053aa1193 'Py_Buffer' should be 'Py_buffer' (closes #24883) 2015-08-17 23:38:34 -07:00
Stefan Krah 70e543b266 Issue #23756: Clarify the terms "contiguous" and "bytes-like object".
Patch by Martin Panter.
2015-08-08 14:33:28 +02:00
Zachary Ware 4ffc3d4480 Merge 3.4 2015-07-07 00:00:43 -05:00
Zachary Ware e36402a830 Fix usage of the default role.
The changes to Doc/library/unittest.mock.rst are almost entirely a
selective backport of the 3.5 page.
2015-07-06 23:58:12 -05:00
Zachary Ware 5c676f67d1 Fix suspicious markup 2015-07-06 23:27:15 -05:00
Nick Coghlan 2ab5b092e5 Close #24458: PEP 489 documentation
Patch by Petr Viktorin.
2015-07-03 19:49:15 +10:00
Yury Selivanov f488fb422a Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. 2015-07-03 01:04:23 -04:00
Yury Selivanov bce294b993 docs.capi: Fix tp_as_async doc 2015-06-23 11:46:09 -04:00
Yury Selivanov 5376ba9630 Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:

1. Coroutines now have a distinct, separate from generators
   type at the C level: PyGen_Type, and a new typedef PyCoroObject.
   PyCoroObject shares the initial segment of struct layout with
   PyGenObject, making it possible to reuse existing generators
   machinery.  The new type is exposed as 'types.CoroutineType'.

   As a consequence of having a new type, CO_GENERATOR flag is
   no longer applied to coroutines.

2. Having a separate type for coroutines made it possible to add
   an __await__ method to the type.  Although it is not used by the
   interpreter (see details on that below), it makes coroutines
   naturally (without using __instancecheck__) conform to
   collections.abc.Coroutine and collections.abc.Awaitable ABCs.

   [The __instancecheck__ is still used for generator-based
   coroutines, as we don't want to add __await__ for generators.]

3. Add new opcode: GET_YIELD_FROM_ITER.  The opcode is needed to
   allow passing native coroutines to the YIELD_FROM opcode.

   Before this change, 'yield from o' expression was compiled to:

      (o)
      GET_ITER
      LOAD_CONST
      YIELD_FROM

   Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.

   The reason for adding a new opcode is that GET_ITER is used
   in some contexts (such as 'for .. in' loops) where passing
   a coroutine object is invalid.

4. Add two new introspection functions to the inspec module:
   getcoroutinestate(c) and getcoroutinelocals(c).

5. inspect.iscoroutine(o) is updated to test if 'o' is a native
   coroutine object.  Before this commit it used abc.Coroutine,
   and it was requested to update inspect.isgenerator(o) to use
   abc.Generator; it was decided, however, that inspect functions
   should really be tailored for checking for native types.

6. sys.set_coroutine_wrapper(w) API is updated to work with only
   native coroutines.  Since types.coroutine decorator supports
   any type of callables now, it would be confusing that it does
   not work for all types of coroutines.

7. Exceptions logic in generators C implementation was updated
   to raise clearer messages for coroutines:

   Before: TypeError("generator raised StopIteration")
   After: TypeError("coroutine raised StopIteration")
2015-06-22 12:19:30 -04:00
Serhiy Storchaka cd881b850c Fixed documentation of functions with const char* arguments. 2015-06-21 17:12:16 +03:00
Serhiy Storchaka 03863d2b29 Fixed documentation of functions with const char* arguments. 2015-06-21 17:11:21 +03:00
Serhiy Storchaka 289dd19124 Added the const qualifier for char* argument of Py_EnterRecursiveCall(). 2015-06-21 16:27:09 +03:00
Serhiy Storchaka 5fa22fc088 Added the const qualifier for char* argument of Py_EnterRecursiveCall(). 2015-06-21 16:26:28 +03:00
Yury Selivanov 6ef059097c Issue 24017: Drop getawaitablefunc and friends in favor of unaryfunc. 2015-05-28 11:21:31 -04:00
Nick Coghlan d5cacbb1d9 PEP 489: Multi-phase extension module initialization
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.
2015-05-23 22:24:10 +10:00
Yury Selivanov a18cad543f Issue 24180: Fixes by Berker Peksag. 2015-05-21 17:02:31 -04:00
Yury Selivanov f3e40fac10 Issue 24180: Documentation for PEP 492 changes. 2015-05-21 11:50:30 -04:00
R David Murray 812bc1b86b Merge: #23088: Clarify null termination of bytes and strings in C API. 2015-05-13 20:32:19 -04:00
R David Murray 0a560a11af #23088: Clarify null termination of bytes and strings in C API.
Patch by Martin Panter, reviewed by Serhiy Storchaka and R. David Murray.
2015-05-13 20:31:53 -04:00
Serhiy Storchaka d894027ec1 Fixed a typo. 2015-05-02 19:25:02 +03:00
Serhiy Storchaka a7db0576ac Fixed a typo. 2015-05-02 19:24:41 +03:00
Larry Hastings 770ce204ee Regenerated pydoc-topics and fixed bad/suspicious doc markup for Python 3.5.0a4. 2015-04-19 13:50:12 -07:00
R David Murray f3cae79883 Merge: #23957: fix typo. 2015-04-14 16:42:49 -04:00
R David Murray 5be7f1513d #23957: fix typo. 2015-04-14 16:42:08 -04:00
Gregory P. Smith a8b120641b issue9014: Include more formatting on :c:type:`PyObject` etc. 2015-04-14 11:21:26 -07:00
Gregory P. Smith 0f2f3bc9db issue9014: Include more formatting on :c:type:`PyObject` etc. 2015-04-14 11:21:05 -07:00
Gregory P. Smith b8dde4f5c3 issue9014: Properly document PyObject_HEAD and friends post-PEP-3123. 2015-04-14 11:13:14 -07:00
Gregory P. Smith 1b24465c93 issue9014: Properly document PyObject_HEAD and friends post-PEP-3123. 2015-04-14 11:12:53 -07:00
Brett Cannon f299abdafa Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
2015-04-13 14:21:02 -04:00
Larry Hastings ab792ac704 Doc clarification / edification on the semantics of the 'w*' format unit. 2015-04-13 11:30:56 -04:00
Victor Stinner 926ce70066 Merge 3.4 (marshal doc) 2015-03-18 13:59:02 +01:00
Victor Stinner 6a318d420a Issue #19428: Document that PyMarshal_ReadLongFromFile() and
PyMarshal_ReadShortFromFile() can fail.
2015-03-18 13:58:49 +01:00
Berker Peksag 32799953b0 Issue #23081: Document that PySequence_List also accepts iterables.
Patch by Lars Buitinck.
2015-03-13 02:55:45 +02:00
Berker Peksag 09bb904fda Issue #23081: Document that PySequence_List also accepts iterables.
Patch by Lars Buitinck.
2015-03-13 02:56:12 +02:00
Stefan Krah 3a43d06321 Whitespace. 2015-02-01 19:46:31 +01:00
Stefan Krah 3e9bec26f4 Whitespace. 2015-02-01 19:45:14 +01:00
Stefan Krah a7e9a6a076 Issue #23352: Merge from 3.4. 2015-02-01 19:42:45 +01:00
Stefan Krah 0dc4e153a2 Issue #23352: Document that Py_buffer.suboffsets must be NULL if no suboffsets
are required.
2015-02-01 19:42:12 +01:00
Serhiy Storchaka d3faf43f9b Issue #23181: More "codepoint" -> "code point". 2015-01-18 11:28:37 +02:00
Georg Brandl 3be472b5f7 Closes #23181: codepoint -> code point 2015-01-14 08:26:30 +01:00
Benjamin Peterson 610bc6a211 merge 3.4 (#23221) 2015-01-13 09:20:31 -05:00
Benjamin Peterson 82f34ada45 fix instances of consecutive articles (closes #23221)
Patch by Karan Goel.
2015-01-13 09:17:24 -05:00
Benjamin Peterson 7a120ecdf4 merge 3.4 (#23110) 2014-12-24 10:51:10 -06:00
Benjamin Peterson b33bb89b1a doucment that Py_SetPath copies its argument (closes #23110) 2014-12-24 10:49:11 -06:00
Serhiy Storchaka b757c83ec6 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:25:22 +02:00
Serhiy Storchaka 92bf919ed0 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:26:10 +02:00
Berker Peksag 87f6c2212e Issue #19676: Tweak documentation a bit.
* Updated version info to 3.5
* Fixed a markup error
* Added a versionadded directive to namereplace_errors documentation
2014-11-25 18:59:20 +02:00
Serhiy Storchaka 166ebc4e5d Issue #19676: Added the "namereplace" error handler. 2014-11-25 13:57:17 +02:00
Georg Brandl e21a531ef1 merge with 3.4 2014-10-31 10:39:29 +01:00
Georg Brandl a4c8c47961 #22613: remaining corrections in extending/reference docs (thanks Jacques Ducasse) 2014-10-31 10:38:49 +01:00
Georg Brandl 93a56cdc37 Doc: fix default role usage (except in unittest mock docs) 2014-10-30 22:25:41 +01:00
Georg Brandl 35aa10be6c merge with 3.4 2014-10-11 15:04:20 +02:00
Georg Brandl e8ea355b72 Closes #21687: delimiter in Py_SetPath is platform dependent 2014-10-11 14:36:02 +02:00
Victor Stinner 8786ea36d0 (Merge 3.4) Closes #22580: Fix documentation of PyUnicode_Tailmatch()
The result type is Py_ssize_t (and not int).
2014-10-09 11:11:49 +02:00
Victor Stinner 13d3aa502d Closes #22580: Fix documentation of PyUnicode_Tailmatch()
The result type is Py_ssize_t (and not int).
2014-10-09 11:11:25 +02:00
Georg Brandl 92b47a4d0f merge with 3.4 2014-10-06 14:38:58 +02:00
Georg Brandl f6d6dc2e36 Clean up the docs of PyObject_IsSubclass and PyObject_IsInstance, and mention that they call the PEP 3119 methods. 2014-10-06 14:38:53 +02:00
Georg Brandl 4ae7839e19 merge with 3.4 2014-10-06 14:15:13 +02:00
Georg Brandl a920b6d762 Closes #22507: document that PyType_IsSubtype does not call __subclasscheck__. 2014-10-06 14:15:06 +02:00
Georg Brandl b65ff1d4f3 merge with 3.4 2014-10-06 12:58:36 +02:00
Georg Brandl 97435166aa Closes #22565: fix argument types of PyErr_WarnEx. 2014-10-06 12:58:00 +02:00
Benjamin Peterson 1fe8ada4e5 merge 3.4 (#18494) 2014-10-05 21:20:51 -04:00
Benjamin Peterson 1c262a6c75 PyObject not PyType (closes #18494) 2014-10-05 21:20:36 -04:00
Georg Brandl 31e34fe7a3 merge with 3.4 2014-10-05 16:38:25 +02:00
Georg Brandl 340c749a3a Closes #19477: remove outdated documentation of tp_print type object slot. 2014-10-05 16:38:02 +02:00
Antoine Pitrou 550ff723a0 Reorganize C API docs of the exception API 2014-09-30 21:56:10 +02:00
Antoine Pitrou 0676a406bf Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` but accepting a `va_list` argument. 2014-09-30 21:16:27 +02:00
Victor Stinner 25e014bd91 Issue #18395, #22108: Update embedded Python examples to decode correctly
command line parameters: use Py_DecodeLocale() and PyUnicode_DecodeFSDefault().
2014-08-01 12:28:49 +02:00
Victor Stinner f6a271ae98 Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, rename
``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these
functions.
2014-08-01 12:28:48 +02:00
Victor Stinner 115171086a Issue #22018: On Windows, signal.set_wakeup_fd() now also supports sockets.
A side effect is that Python depends to the WinSock library.
2014-07-29 23:31:34 +02:00
Victor Stinner 1d8948e023 Backout 42ced0d023cd: oops, i didn't want to push this changeset :-/ 2014-07-24 22:51:05 +02:00
Victor Stinner d18ccd19f0 tets 2014-07-24 21:58:53 +02:00
Benjamin Peterson 0172b115db merge 3.4 (#17210) 2014-07-19 16:35:08 -07:00
Benjamin Peterson 102488b644 args doesn't need to be a tuple (closes #17210) 2014-07-19 16:34:33 -07:00
Andrew Svetlov a6237d822a Merge 3.4 2014-07-03 16:07:57 +03:00
Andrew Svetlov 0d50af45b6 Update docs about tp_richcompare 2014-07-03 16:07:17 +03:00
Stefan Krah d95224ceaf Merge 3.4. 2014-06-30 00:16:09 +02:00
Stefan Krah bb458dbe59 Issue #21778: Clarify use of flags if PyBuffer_FillInfo() is used inside a
getbufferproc().
2014-06-30 00:15:45 +02:00
Jesus Cea 7232986239 MERGE: Closes #21441: Reorder elements in documentation to match actual order in the code 2014-06-25 05:38:40 +02:00
Jesus Cea ca5c7153de MERGE: Closes #21441: Reorder elements in documentation to match actual order in the code 2014-06-25 05:38:06 +02:00
Jesus Cea e8ef8b7a20 Closes #21441: Reorder elements in documentation to match actual order in the code 2014-06-25 05:37:17 +02:00
Zachary Ware 83500dc7a5 Merge quote quashing. 2014-06-06 09:14:33 -05:00
Zachary Ware 780b585fbc Quash extraneous quote. 2014-06-06 09:13:18 -05:00
Victor Stinner d8f0d922d5 Issue #21233: Rename the C structure "PyMemAllocator" to "PyMemAllocatorEx" to
make sure that the code using it will be adapted for the new "calloc" field
(instead of crashing).
2014-06-02 21:57:10 +02:00
Eric Snow b7f1be309e Merge from 3.4 (for #21226). 2014-05-12 18:25:00 -06:00
Eric Snow 08197a4616 Issue #21226: Set all attrs in PyImport_ExecCodeModuleObject. 2014-05-12 17:54:55 -06:00
Victor Stinner db067af12a Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int) are now
using ``calloc()`` instead of ``malloc()`` for large objects which is faster
and use less memory (until the bytearray buffer is filled with data).
2014-05-02 22:31:14 +02:00
Antoine Pitrou 63aeb71909 Issue #9307: document the various Py_TPFLAGS_*_SUBCLASS flags. Patch by Yury V. Zaytsev. 2014-04-29 01:39:26 +02:00
Antoine Pitrou f9f54a2f5f Issue #9307: document the various Py_TPFLAGS_*_SUBCLASS flags. Patch by Yury V. Zaytsev. 2014-04-29 01:39:03 +02:00
Benjamin Peterson d51374ed78 PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) 2014-04-09 23:55:56 -04:00
Benjamin Peterson ce0700ae7a PySequence_Fast generally returns a list not a tuple (closes #16395) 2014-04-08 10:48:36 -04:00
Benjamin Peterson f0f7844f38 the name of the slot of nb_multiply not nb_mul 2014-04-08 10:44:30 -04:00
Brett Cannon 18fc4e70f3 Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets
__file__.

This causes _frozen_importlib to no longer have __file__ set as well
as any frozen module imported using imp.init_frozen() (which is
deprecated).
2014-04-04 10:01:46 -04:00
Andrew Svetlov 08af00047b Get rid of deprecated IOError in the doc 2014-04-01 01:13:30 +03:00
Georg Brandl 1c669c1154 Closes #18456: Doc fix: PyDict_Update only works with dict-like objects, not key-value sequences. Patch by priyapappachan. 2014-03-25 09:34:30 +01:00
Georg Brandl df48b97855 Fix a few scoping issues with versionadded/versionchanged directives. 2014-03-24 09:06:18 +01:00
Larry Hastings 3732ed2414 Merge in all documentation changes since branching 3.4.0rc1. 2014-03-15 21:13:56 -07:00
Éric Araujo fa5e6e4773 Fix note markup (#16805).
Patch by Tshepang Lekhonkhobe, reviewed by Georg Brandl.
2014-03-12 19:51:00 -04:00
Zachary Ware 7bbd101bb1 Fix several C-API doc typos caught by tomo cocoa on docs@.
The signature and description of PyException_SetCause now use "cause"
rather than "ctx" to match the code.
2014-02-26 10:40:38 -06:00
Larry Hastings 8f9f0f12e8 Issue #20517: Removed unnecessary new (short-lived) functions from PyErr. 2014-02-10 03:43:57 -08:00
Larry Hastings b082731fbb Issue #20517: Functions in the os module that accept two filenames
now register both filenames in the exception on failure.
This required adding new C API functions allowing OSError exceptions
to reference two filenames instead of one.
2014-02-09 22:05:19 -08:00
Nick Coghlan c0bc0b46bb Issue #20500: Note other public APIs with the new assertion 2014-02-09 12:00:01 +10:00
Nick Coghlan 3d7b3641d3 Note the new debug assertion in PyObject_Str 2014-02-09 10:57:34 +10:00
Nick Coghlan aa029dad50 Tweaks to What's New and some referenced docs 2014-02-09 10:10:24 +10:00
Martin v. Löwis ca7b04644c Issue #17162: Add PyType_GetSlot. 2014-02-04 09:33:05 +01:00
Zachary Ware 28479d8c7d Issue #20460: Merge with 3.3 2014-01-31 12:06:48 -06:00
Zachary Ware a479b7505e Issue #20460: Render 'bytes' as a class, not a function.
Patch by OSAMU NAKAMURA.
2014-01-31 12:06:14 -06:00
Nick Coghlan 77b286b2cc Close #20105: set __traceback__ when chaining exceptions in C 2014-01-27 00:53:38 +10:00
Larry Hastings 2a727916c5 Issue #20226: Major improvements to Argument Clinic.
* You may now specify an expression as the default value for a
  parameter!  Example: "sys.maxsize - 1".  This support is
  intentionally quite limited; you may only use values that
  can be represented as static C values.
* Removed "doc_default", simplified support for "c_default"
  and "py_default".  (I'm not sure we still even need
  "py_default", but I'm leaving it in for now in case a
  use presents itself.)
* Parameter lines support a trailing '\\' as a line
  continuation character, allowing you to break up long lines.
* The argument parsing code generated when supporting optional
  groups now uses PyTuple_GET_SIZE instead of PyTuple_GetSize,
  leading to a 850% speedup in parsing.  (Just kidding, this
  is an unmeasurable difference.)
* A bugfix for the recent regression where the generated
  prototype from pydoc for builtins would be littered with
  unreadable "=<object ...>"" default values for parameters
  that had no default value.
* Converted some asserts into proper failure messages.
* Many doc improvements and fixes.
2014-01-16 11:32:01 -08:00
Victor Stinner e8453bc136 C API doc: try to group concrete objects 2013-11-07 22:05:48 +01:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Nick Coghlan 1805a62f1f Issue #16129: Py_SetStandardStreamEncoding cleanups
- don't call PyErr_NoMemory with interpreter is not initialised
- note that it's OK to call _PyMem_RawStrDup here
- don't include this in the limited API
- capitalise "IO"
- be explicit that a non-zero return indicates an error
- include versionadded marker in docs
2013-10-18 23:11:47 +10:00
Nick Coghlan 7d270ee05d Issue #16129: Add `Py_SetStandardStreamEncoding`
This new pre-initialization API allows embedding
applications like Blender to force a particular
encoding and error handler for the standard IO streams.

Also refactors Modules/_testembed.c to let us start
testing multiple embedding scenarios.

(Initial patch by Bastien Montagne)
2013-10-17 22:35:35 +10:00
Georg Brandl 7c11e52f7e merge with 3.3 2013-10-12 20:01:14 +02:00
Georg Brandl 5c01d99c12 Introduce support for documenting which C API elements are not part of the stable/limited API. 2013-10-12 19:54:30 +02:00
Georg Brandl a636c8e150 merge with 3.3 2013-10-12 19:03:47 +02:00
Georg Brandl ae30a813a9 Closes #13833: document PyStructSequence C-API functions. 2013-10-12 19:03:43 +02:00
Victor Stinner 2fe9bac4dc Close #16742: Fix misuse of memory allocations in PyOS_Readline()
The GIL must be held to call PyMem_Malloc(), whereas PyOS_Readline() releases
the GIL to read input.

The result of the C callback PyOS_ReadlineFunctionPointer must now be a string
allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL if an error
occurred), instead of a string allocated by PyMem_Malloc() or PyMem_Realloc().

Fixing this issue was required to setup a hook on PyMem_Malloc(), for example
using the tracemalloc module.

PyOS_Readline() copies the result of PyOS_ReadlineFunctionPointer() into a new
buffer allocated by PyMem_Malloc(). So the public API of PyOS_Readline() does
not change.
2013-10-10 16:18:20 +02:00
Victor Stinner 6cf185dc06 Issue #18874: _PyObject_Malloc/Realloc/Free() now falls back on
_PyMem_RawMalloc/Realloc/Free, instead of _PyMem_Malloc/Realloc/Free.  So it
becomes possible to use the fast pymalloc allocator for the PYMEM_DOMAIN_MEM
domain (PyMem_Malloc/Realloc/Free functions).
2013-10-10 15:58:42 +02:00
Raymond Hettinger 5ed3bc9adb merge 2013-10-09 22:43:30 -07:00
Raymond Hettinger 8ee7708c7f Issue #19005: Fix documentation for PyIter_Next(). 2013-10-09 22:42:46 -07:00
Serhiy Storchaka d51f42372b Issue 19195: Improved cross-references in C API documentation. 2013-10-09 13:26:57 +03:00
Serhiy Storchaka 0b68a2d675 Issue 19195: Improved cross-references in C API documentation. 2013-10-09 13:26:17 +03:00
Antoine Pitrou c8fb4fc96e Add a "skull and crossbones" to Py_AddPendingCall. 2013-09-30 21:38:49 +02:00
Antoine Pitrou 1a67bee701 Add a "skull and crossbones" to Py_AddPendingCall. 2013-09-30 21:35:44 +02:00
Victor Stinner 14e461d5b9 Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Serhiy Storchaka bbbf191707 Issue #18743: Fix references to non-existant "StringIO" module. 2013-08-17 00:11:54 +03:00
Serhiy Storchaka e79be877df Issue #18743: Fix references to non-existant "StringIO" module. 2013-08-17 00:09:55 +03:00
Christian Heimes ad73a9cf97 Issue #16400: Add command line option for isolated mode.
-I

    Run Python in isolated mode. This also implies -E and -s. In isolated mode
    sys.path contains neither the script’s directory nor the user’s
    site-packages directory. All PYTHON* environment variables are ignored,
    too. Further restrictions may be imposed to prevent the user from
    injecting malicious code.
2013-08-10 16:36:18 +02:00
Eli Bendersky 562d9cbfe9 Issue #18668: Further clarify m_size setting for non-negative values 2013-08-10 05:58:10 -07:00
Eli Bendersky 43694a50ab Issue #18668: Further clarify m_size setting for non-negative values 2013-08-10 05:57:27 -07:00
Serhiy Storchaka 0738aff368 Fix a typo in PyUnicode_CopyCharacters() documentation. 2013-08-08 16:49:45 +03:00
Serhiy Storchaka cdd0279b0b Fix a typo in PyUnicode_CopyCharacters() documentation. 2013-08-08 16:47:43 +03:00
Eli Bendersky 7533137f4e Closing #18668: Properly document setting m_size in PyModuleDef 2013-08-07 05:54:28 -07:00
Eli Bendersky 0d2d2b8393 Issue #18668: Properly document setting m_size in PyModuleDef 2013-08-07 05:52:20 -07:00
Antoine Pitrou a68cbfa556 Issue #18589: fix hyperlinking of type slots (tp_*) 2013-08-01 21:14:43 +02:00
Antoine Pitrou 39668f57f4 Issue #18589: fix hyperlinking of type slots (tp_*) 2013-08-01 21:12:45 +02:00
Antoine Pitrou 796564c27b Issue #18112: PEP 442 implementation (safe object finalization). 2013-07-30 19:59:21 +02:00
Victor Stinner 0507bf56f0 Issue #3329: Implement the PEP 445
Add new enum:

* PyMemAllocatorDomain

Add new structures:

* PyMemAllocator
* PyObjectArenaAllocator

Add new functions:

* PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
* PyMem_GetAllocator(), PyMem_SetAllocator()
* PyObject_GetArenaAllocator(), PyObject_SetArenaAllocator()
* PyMem_SetupDebugHooks()

Changes:

* PyMem_Malloc()/PyObject_Realloc() now always call malloc()/realloc(), instead
  of calling PyObject_Malloc()/PyObject_Realloc() in debug mode.
* PyObject_Malloc()/PyObject_Realloc() now falls back to
  PyMem_Malloc()/PyMem_Realloc() for allocations larger than 512 bytes.
* Redesign debug checks on memory block allocators as hooks, instead of using C
  macros
2013-07-07 02:05:46 +02:00
Brett Cannon 679ecb565b Issue #15767: back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
2013-07-04 17:51:50 -04:00
Brett Cannon 82da8886cc Issue #15767: Revert 3a50025f1900 for ModuleNotFoundError 2013-07-04 17:48:16 -04:00
Victor Stinner 36f01ad9ac Revert changeset 6661a8154eb3: Issue #3329: Add new APIs to customize memory allocators
The new API require more discussion.
2013-06-15 03:37:01 +02:00
Victor Stinner 4d7056258b Issue #3329: Add new APIs to customize memory allocators
* Add a new PyMemAllocators structure
* New functions:

  - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory
    allocator functions
  - PyMem_GetRawAllocators(), PyMem_SetRawAllocators()
  - PyMem_GetAllocators(), PyMem_SetAllocators()
  - PyMem_SetupDebugHooks()
  - _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators()

* Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0)
* Add unit test for new get/set allocators functions
* PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if
  size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls
  back on PyMem_Realloc() instead of realloc()
* PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(),
  instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
2013-06-15 00:37:46 +02:00
Brett Cannon 8f5ac5106e Issue #15767: Touch up ModuleNotFoundError usage by import.
Forgot to raise ModuleNotFoundError when None is found in sys.modules.
This led to introducing the C function PyErr_SetImportErrorSubclass()
to make setting ModuleNotFoundError easier.

Also updated the reference docs to mention ModuleNotFoundError
appropriately. Updated the docs for ModuleNotFoundError to mention the
None in sys.modules case.

Lastly, it was noticed that PyErr_SetImportError() was not setting an
exception when returning None in one case. That issue is now fixed.
2013-06-12 23:29:18 -04:00
Brett Cannon b1611e2772 Issue #15767: Introduce ModuleNotFoundError, a subclass of
ImportError.

The exception is raised by import when a module could not be found.
Technically this is defined as no viable loader could be found for the
specified module. This includes ``from ... import`` statements so that
the module usage is consistent for all situations where import
couldn't find what was requested.

This should allow for the common idiom of::

  try:
    import something
  except ImportError:
    pass

to be updated to using ModuleNotFoundError and not accidentally mask
ImportError messages that should propagate (e.g. issues with a
loader).

This work was driven by the fact that the ``from ... import``
statement needed to be able to tell the difference between an
ImportError that simply couldn't find a module (and thus silence the
exception so that ceval can raise it) and an ImportError that
represented an actual problem.
2013-06-12 16:59:46 -04:00
Serhiy Storchaka 1cfebc73e0 Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and
PyObject_CallMethod() now changed to `const char*`.
Based on patches by Jörg Müller and Lars Buitinck.
2013-05-29 18:50:54 +03:00
Andrew Kuchling 1e170bae71 #1554133: Document PyOS_InputHook, PyOS_ReadlineFunctionPointer 2013-05-28 21:48:28 -04:00
Victor Stinner 8cecc8c262 Issue #7330: Implement width and precision (ex: "%5.3s") for the format string
of PyUnicode_FromFormat() function, original patch written by Ysj Ray.
2013-05-06 23:11:54 +02:00
Brett Cannon 4c14b5de1c #17115,17116: Have modules initialize the __package__ and __loader__
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.
2013-05-04 13:56:58 -04:00
Ezio Melotti 4cfc0b5411 #16518: merge with 3.3. 2013-05-04 18:07:12 +03:00
Ezio Melotti c228e96726 #16518: use "bytes-like object" throughout the docs. 2013-05-04 18:06:34 +03:00
Georg Brandl f36f20f850 merge with 3.3 2013-04-14 11:16:46 +02:00
Georg Brandl 991fc5736e Closes #13638: document PyErr_SetFromErrnoWithFilenameObject,
PyErr_SetFromWindowsErrWithFilenameObject, and
PyErr_SetExcFromWindowsErrWithFilenameObject.

Note that PyErr_SetExcFromWindowsErrWithFilenameObjectAndSomeOtherParametersSoThatTheNameGetsSoLongThatNobodyIsEverGonnaUseThisStrangeFunctionForAnything is still undocumented.
2013-04-14 11:12:16 +02:00