代码之家  ›  专栏  ›  技术社区  ›  user32882

希望将官方cpython库中的提交与python版本关联起来

  •  0
  • user32882  · 技术社区  · 3 年前

    我目前正在使用whl文件中提供给我的程序包。我能够使用 pip 。但是,当我查看源代码时,包似乎期望 _special 属性存在于 _GenericAlias 的类 typing 单元在最新版本的python 打字 模块,看起来该属性不存在。然而,它看起来确实存在于某个时间点,如中所示 this link

    我想弄清楚我需要安装哪个版本的python才能在 打字 单元我可以从上面的链接中看到,提交时就是这样 6292be7adf 但我不知道如何将这个提交与我可以使用的特定python版本联系起来 pip conda 在我的环境中安装。

    我如何才能找到包含上述代码的确切版本?

    0 回复  |  直到 3 年前
        1
  •  1
  •   vaizki    3 年前

    好的,我克隆了整个cpython repo并进行了搜索:

    $ git log -S 'self._special = special'
    commit c1c7d8ead9eb214a6149a43e31a3213c52448877
    Author: Serhiy Storchaka <storchaka@gmail.com>
    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 <levkivskyi@gmail.com>
    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.
    

    所以这个属性是在 d911e40e788fb679723d78b6ea11cabf46caed5a 哪个在 3.7.0b1 并在中删除 c1c7d8ead9eb214a6149a43e31a3213c52448877 哪个在 3.9.0b1 .里面的任何东西 3.7 3.8 应该拥有它。