Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve message of PyType_Spec deprecation warning with location #107810

Closed
Labels
triagedThe issue has been accepted as valid by a triager.type-featureA feature request or enhancement
@cdce8p

Description

@cdce8p

Bug report

A clear and concise description of the bug

Followup to#103968 (comment).
The DeprecationWarning forPyType_Spec in3.12.0rc1 is emitted on<frozen importlib._bootstrap>:400 which makes it quite difficult to know what package is responsible.

In my particular case I found that, after reading#103968, it might beprotobuf.
And indeed that's how I can reproduce it.

# test.pyfromgoogle.protobufimportdescriptor
pip install protobuf==4.24.0python -X dev test.py
<frozen importlib._bootstrap>:400    DeprecationWarning: Using PyType_Spec with metaclasses that have custom tp_new is deprecated and will no longer be allowed in Python 3.14.

To be clear, I don't mind the warning. I'm just wondering if it's possible to improve the error location.
/CC@encukou

--
The relevant CPython code

if (PyErr_WarnFormat(
PyExc_DeprecationWarning,1,
"Using PyType_Spec with metaclasses that have custom "
"tp_new is deprecated and will no longer be allowed in "
"Python 3.14.")<0) {
gotofinally;
}

And protobuf where it's likely (?) created:
https://github.com/protocolbuffers/protobuf/blob/v4.24.0/python/google/protobuf/pyext/map_container.cc#L562
https://github.com/protocolbuffers/protobuf/blob/v4.24.0/python/google/protobuf/pyext/map_container.cc#L778

Your environment

  • CPython versions tested on:3.12.0rc1 and with the latest3.12 commit:3bb43b7
  • Operating system and architecture: MacOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedThe issue has been accepted as valid by a triager.type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp