[ 
https://issues.apache.org/jira/browse/AMBARI-26524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jialiang Cai resolved AMBARI-26524.
-----------------------------------
    Resolution: Fixed

> Fix "inspect" deprecations for Python 3.11 compatibility
> --------------------------------------------------------
>
>                 Key: AMBARI-26524
>                 URL: https://issues.apache.org/jira/browse/AMBARI-26524
>             Project: Ambari
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Gandhe harshith
>            Assignee: Gandhe harshith
>            Priority: Major
>             Fix For: 3.1.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> from [https://docs.python.org/3/whatsnew/3.11.html] 
> Removed from the 
> [{{inspect}}|https://docs.python.org/3/library/inspect.html#module-inspect] 
> module:
>  * The {{getargspec()}} function, deprecated since Python 3.0; use 
> [{{inspect.signature()}}|https://docs.python.org/3/library/inspect.html#inspect.signature]
>  or 
> [{{inspect.getfullargspec()}}|https://docs.python.org/3/library/inspect.html#inspect.getfullargspec]
>  instead.
>  * The {{formatargspec()}} function, deprecated since Python 3.5; use the 
> [{{inspect.signature()}}|https://docs.python.org/3/library/inspect.html#inspect.signature]
>  function or the 
> [{{inspect.Signature}}|https://docs.python.org/3/library/inspect.html#inspect.Signature]
>  object directly.
> Apply required changes to support python3.11
> ----
> in python3.10
>  
> {code:java}
> Python 3.10.18 (main, Jun 12 2025, 02:22:13) [GCC 12.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import inspect
> >>> inspect.formatargspec
> <function formatargspec at 0xffff85a50dc0>
> >>>
> >>> inspect.getargspec
> <function getargspec at 0xffff85a500d0> 
> >>>
> >>> inspect.getfullargspec
> <function getfullargspec at 0xffff85a505e0>
> >>>
> >>> inspect.signature
> <function signature at 0xffff85a52dd0>
> >>>{code}
> and in python3.11
>  
>  
> {code:java}
> Python 3.11.13 (main, Jun 12 2025, 02:01:52) [GCC 12.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> >>> import inspect
> >>> inspect.formatargspec
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: module 'inspect' has no attribute 'formatargspec'. Did you 
> mean: 'formatargvalues'?
> >>>
> >>> inspect.getargspec
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 
> 'getargs'?
> >>> 
> >>> inspect.getfullargspec
> <function getfullargspec at 0xffff82280d60>
> >>>
> >>> inspect.signature
> <function signature at 0xffff82283a60>{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to