-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python bindings: accessing deprecated code should emit DeprecationWarning #5967
Comments
Yes please!, this would be great :) |
I think this ought to cover some of it at least. I haven't come up with a good way of reporting this for properties yet. |
I found #6123 broke some things: fprint = lt.fingerprint("AB", 1, 2, 3, 4)
self.assertEqual(fprint.major_version, 1)
"""
TypeError: No Python class registered for C++ class deprecate_visitor<int libtorrent::fingerprint::*>
""" |
There's also a quirk: with deprecated functions enabled, |
With #6335, I think the only outstanding work is to raise My C++ isn't strong enough to figure out a nice way to get these things to raise |
Warnings in python are soft errors, which can be configured at runtime to either be ignored, raise an exception, or print a message to stderr.
There are a few built-in classes of warnings.
DeprecationWarning
is ignored by default, but are printed when encountered by unit test runners, which makes it a good choice for complaining to developers about using deprecated functions, while not annoying users.I think all deprecated code in the python bindings should emit
DeprecationWarning
. Adding warnings isn't expected to break any usage, so it should be reasonable to emit new warnings in all branches, even in a point release.Ideally, even getting a deprecated attribute would emit the warning. That is, it should be emitted by both of these:
The functions to emit warnings from python C API are PyErr_WarnEx() and friends.
The text was updated successfully, but these errors were encountered: