lballabio / QuantLib-SWIG

QuantLib wrappers to other languages
Other
338 stars 282 forks source link

Python QuantLib==1.3.4 issues DeprecationWarning on import #647

Open cdcadman opened 3 months ago

cdcadman commented 3 months ago

Here is a demonstration in the interactive shell, running python 3.12 with QuantLib version 1.34. When I use QuantLib version 1.33, these warnings are not issued:

C:\>python -Walways
Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import QuantLib
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
>>>
boring-cyborg[bot] commented 3 months ago

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

lballabio commented 3 months ago

Thanks! This needs to be fixed in SWIG. It seems to be a known issue: https://github.com/swig/swig/issues/2881.

This only happens with the -Walways, right?

cdcadman commented 3 months ago

Yes, DeprecationWarning is ignored by python's default warning filter, so I used the -Walways to make it print out. I first noticed the warnings in pytest logs for some code that uses QuantLib.

github-actions[bot] commented 1 month ago

This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.

github-actions[bot] commented 1 month ago

This issue was automatically closed because it has been stalled for two weeks with no further activity.