[Python-Dev] Clarification regarding Stable ABI and _Py_*

2021-12-06 Thread Guido van Rossum
Hi Petr,

In PEP 384 it is written that no functions starting with an underscore are
part of the stable ABI:

PEP 384 -- Defining a Stable ABI | Python.org

> All functions starting with _Py are not available to applications

OTOH there's a data file in the repo, Misc/stabe_abi.txt, which lists many
functions starting with _Py_, for example _PyObject_GC_Malloc. Then again,
that function is not listed in Doc/data/stable_abi.dat. (I didn't check
other functions, but maybe there are others.)

So is Misc/stable_abi.txt just out of date? Or how can the discrepancy be
explained?

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*

___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/64VOMHNR37N4HVPWAHKHJM4UFYJPVKSV/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Clarification regarding Stable ABI and _Py_*

2021-12-06 Thread Petr Viktorin

On 06. 12. 21 20:29, Guido van Rossum wrote:

Hi Petr,

In PEP 384 it is written that no functions starting with an underscore 
are part of the stable ABI:


PEP 384 -- Defining a Stable ABI | Python.org 


 > All functions starting with _Py are not available to applications

OTOH there's a data file in the repo, Misc/stabe_abi.txt, which lists 
many functions starting with _Py_, for example _PyObject_GC_Malloc. Then 
again, that function is not listed in Doc/data/stable_abi.dat. (I didn't 
check other functions, but maybe there are others.)


So is Misc/stable_abi.txt just out of date? Or how can the discrepancy 
be explained?


These are not part of the limited API, so extension authors can't use 
them in the C source. But they typically are (or have been) called by 
macros from the limited API. So, they are part of the stable ABI; they 
need to be exported.


Misc/stable_abi.txt says "abi_only" for all of these. They don't show up 
in the user-facing docs.


___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/WB3W2QY4PLM5XGLQMEEC4HE3HSQ4M3KO/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Clarification regarding Stable ABI and _Py_*

2021-12-06 Thread Guido van Rossum
On Mon, Dec 6, 2021 at 12:12 PM Petr Viktorin  wrote:

> On 06. 12. 21 20:29, Guido van Rossum wrote:
> > Hi Petr,
> >
> > In PEP 384 it is written that no functions starting with an underscore
> > are part of the stable ABI:
> >
> > PEP 384 -- Defining a Stable ABI | Python.org
> > 
> >  > All functions starting with _Py are not available to applications
> >
> > OTOH there's a data file in the repo, Misc/stabe_abi.txt, which lists
> > many functions starting with _Py_, for example _PyObject_GC_Malloc. Then
> > again, that function is not listed in Doc/data/stable_abi.dat. (I didn't
> > check other functions, but maybe there are others.)
> >
> > So is Misc/stable_abi.txt just out of date? Or how can the discrepancy
> > be explained?
>
> These are not part of the limited API, so extension authors can't use
> them in the C source. But they typically are (or have been) called by
> macros from the limited API. So, they are part of the stable ABI; they
> need to be exported.
>
> Misc/stable_abi.txt says "abi_only" for all of these. They don't show up
> in the user-facing docs.
>

Thanks, that helps. It's too bad that there's no comment at the top
explaining the format (in fact it appears to discourage reading the file?).

Also, it looks like Mark is proposing to *remove* _PyObject_GC_Malloc from
stable_abi.txt in https://github.com/python/cpython/pull/29879 Is that
allowed? If it's being used by a macro it means code using that macro will
fail unless recompiled for 3.11.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*

___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/B3ZZK4QNEFF4F2NV4D32YXQJCV477TEN/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Clarification regarding Stable ABI and _Py_*

2021-12-06 Thread Victor Stinner
On Mon, Dec 6, 2021 at 9:54 PM Guido van Rossum  wrote:
> Also, it looks like Mark is proposing to *remove* _PyObject_GC_Malloc from 
> stable_abi.txt

In Python 3.2, _PyObject_GC_Malloc() is implemented as a function.
PyObject_GC_New() macro calls _PyObject_GC_New() function. Internally,
PyType_GenericAlloc() and _PyObject_GC_New() call
_PyObject_GC_Malloc().

=> IMO _PyObject_GC_Malloc() doesn't need to be part of Python 3.2 stable ABI

In Python 3.11, _PyObject_GC_Malloc() is still implemented as a
function. It's not used in the C API header files, it's only used in
the implementation of other functions.

=> IMO again, IMO _PyObject_GC_Malloc() doesn't need to be part of
Python 3.11 stable ABI

It would be nice if someone could double check my analysis.


In Python 3.7, there was still "#undef _PyObject_GC_Malloc" in
Modules/gcmodule.c with the comment:

/* extension modules might be compiled with GC support so these
   functions must always be available */

This code comes from an old commit made for ABI compatibility with...
Python 2.2!

https://github.com/python/cpython/commit/fec4eb1be1bb193ab3db0645a2c084c34868401c
---
commit fec4eb1be1bb193ab3db0645a2c084c34868401c
Author: Neil Schemenauer 
Date:   Fri Apr 12 02:41:03 2002 +

Allow PyObject_Del to be used as a function designator.  Provide binary
compatibility function.

Make PyObject_GC_Track and PyObject_GC_UnTrack functions instead of
trivial macros wrapping functions.  Provide binary compatibility
functions.
---

I don't think that Python 3.2 needs to provide ABI compatibility with
Python 2.2.

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/4SUSFYA2P3CLCP3ULYSXETM2QEBNUWQG/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] [RELEASE] Python 3.10.1 is available

2021-12-06 Thread Pablo Galindo Salgado
I hope you like bug fixes, because we have a whole shipment of them! Python
3.10.1 is the first maintenance release of Python 3.10 as we have packed
more than 330 commits of fixes and general improvements. You can get it
here:

https://www.python.org/downloads/release/python-3101/

# This is the first maintenance release of Python 3.10

Python 3.10.1 is the newest major release of the Python programming
language, and it contains many new features and optimizations.

# Major new features of the 3.10 series, compared to 3.9

Among the new major new features and changes so far:

* [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Deprecate and
prepare for the removal of the wstr member in PyUnicodeObject.
* [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing
union types as X | Y
* [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter
Specification Variables
* [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line
numbers for debugging and other tools.
* [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional
Length-Checking To zip.
* [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context
managers are now officially allowed.
* [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate
distutils module.
* [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type
Aliases
* [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural
Pattern Matching: Specification
* [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural
Pattern Matching: Motivation and Rationale
* [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural
Pattern Matching: Tutorial
* [PEP 644 ](https://www.python.org/dev/peps/pep-0644/) -- Require OpenSSL
1.1.1 or newer
* [PEP 624 ](https://www.python.org/dev/peps/pep-0624/) -- Remove
Py_UNICODE encoder APIs
* [PEP 597 ](https://www.python.org/dev/peps/pep-0597/) -- Add optional
EncodingWarning

[bpo-38605](https://bugs.python.org/issue38605): `from __future__ import
annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) used to
be on this list
in previous pre-releases but it has been postponed to Python 3.11 due to
some compatibility concerns. You can read the Steering Council
communication about it [here](
https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/)
to learn more.

# More resources

* [Changelog](https://docs.python.org/3.10/whatsnew/changelog.html#changelog
)
* [Online Documentation](https://docs.python.org/3.10/)
* [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release
Schedule
* Report bugs at [https://bugs.python.org](https://bugs.python.org).
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different

The Meissner effect (or Meissner–Ochsenfeld effect) is the expulsion of a
magnetic field from a superconductor during its transition to the
superconducting state when it is cooled below the critical temperature.
This expulsion will repel a nearby magnet. The German physicists Walther
Meissner and Robert Ochsenfeld discovered this phenomenon in 1933 by
measuring the magnetic field distribution outside superconducting tin and
lead samples. The experiment demonstrated for the first time that
superconductors were more than just perfect conductors and provided a
uniquely defining property of the superconductor state. The ability for the
expulsion effect is determined by the nature of equilibrium formed by the
neutralization within the unit cell of a superconductor.

You can do [ver cool things](https://www.youtube.com/watch?v=HRLvVkkq5GE)
with it!

# We hope you enjoy the new releases!

Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.

https://www.python.org/psf/

Your friendly release team,
Ned Deily @nad https://discuss.python.org/u/nad
Steve Dower @steve.dower https://discuss.python.org/u/steve.dower
Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/CFCZC5ZQFSQD3C32IKHO6SQSZHCWZTNC/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] PEP template file now available

2021-12-06 Thread Brett Cannon
I just pushed an update to PEP 12 which includes a complete PEP template
file.

You can see the file at
https://github.com/python/peps/blob/main/pep-0012/pep-.rst and it is
also embedded in PEP 12 at https://python.github.io/peps/pep-0012/#template
(it will hit the official URL eventually).
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/I5V2ZHQMQIHAW7HR4JNIA7JJKPORJBSM/
Code of Conduct: http://python.org/psf/codeofconduct/