user32882
user32882

Reputation: 5897

Would like to relate commit in official cpython library to a python release

I'm currently using a package provided to me in a whl file. I was able to install this package using pip. However, when I looked through the source code, it appears that the package expects the _special attribute to exist in the _GenericAlias class of the typing module. In the latest version of python's typing module, it looks like this attribute is not present. However, it looks like it did exist at a certain point in time as shown in this link.

I would like to figure out which version of python I need to install for this attribute to exist in the typing module. I can see from the link above that this was the case in commit 6292be7adf but I haven't a clue how to relate this commit to a specific python version that I can pip or conda install in my environment.

How can I come up with the exact version that contains the above code?

Upvotes: 0

Views: 57

Answers (1)

vaizki
vaizki

Reputation: 1932

Ok I cloned the whole cpython repo and did a search:

$ git log -S 'self._special = special'
commit c1c7d8ead9eb214a6149a43e31a3213c52448877
Author: Serhiy Storchaka <[email protected]>
Date:   Thu May 7 04:09:33 2020 +0300

    bpo-40397: Refactor typing._GenericAlias (GH-19719)

    Make the design more object-oriented.
    Split _GenericAlias on two almost independent classes: for special
    generic aliases like List and for parametrized generic aliases like List[int].
    Add specialized subclasses for Callable, Callable[...], Tuple and Union[...].

commit d911e40e788fb679723d78b6ea11cabf46caed5a
Author: Ivan Levkivskyi <[email protected]>
Date:   Sat Jan 20 11:23:59 2018 +0000

    bpo-32226: PEP 560: improve typing module (#4906)

    This PR re-designs the internal typing API using the new PEP 560 features.
    However, there are only few minor changes in the public API.

So this attribute was introduced in d911e40e788fb679723d78b6ea11cabf46caed5a which is in 3.7.0b1 and removed in c1c7d8ead9eb214a6149a43e31a3213c52448877 which is in 3.9.0b1. Anything in 3.7 or 3.8 should have it.

Upvotes: 1

Related Questions