Skip to content
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

Add qualname support to types.FunctionType #58063

Closed
meadori opened this issue Jan 24, 2012 · 3 comments
Closed

Add qualname support to types.FunctionType #58063

meadori opened this issue Jan 24, 2012 · 3 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@meadori
Copy link
Member

meadori commented Jan 24, 2012

BPO 13855
Nosy @pitrou, @meadori

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2012-01-24.20:14:47.253>
labels = ['type-feature', 'library']
title = 'Add qualname support to types.FunctionType'
updated_at = <Date 2019-03-16.00:11:55.835>
user = 'https://github.com/meadori'

bugs.python.org fields:

activity = <Date 2019-03-16.00:11:55.835>
actor = 'BreamoreBoy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2012-01-24.20:14:47.253>
creator = 'meador.inge'
dependencies = []
files = []
hgrepos = []
issue_num = 13855
keywords = []
message_count = 2.0
messages = ['151925', '222159']
nosy_count = 3.0
nosy_names = ['pitrou', 'Arfrever', 'meador.inge']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue13855'
versions = ['Python 3.5']

@meadori
Copy link
Member Author

meadori commented Jan 24, 2012

As mentioned in bpo-13672 currently there is no way to specify a
qualname on types.FunctionType:

>>> def f():
...    def g():
...       pass
...    return g
... 
>>> g = f()
>>> g
<function f.<locals>.g at 0x7f1dac4d8ba0>
>>> types.FunctionType(f.__code__, {})
<function f at 0x7f1dac4dfae0>
>>> types.FunctionType(g.__code__, {})

If bpo-13672 is fixed, then the qualname can be derived from the passed
in code object like name is. We can also add an optional parameter to
the FunctionType constructor for qualname.

I am working on a patch relative to the one I just posted for
bpo-13672.

@meadori meadori added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir labels Jan 24, 2012
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Jul 3, 2014

Note that bpo-13672 refers to bpo-12857.

@BreamoreBoy BreamoreBoy mannequin added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Jul 3, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel
Copy link
Member

This seems out of date:

>>> import types
>>> types.FunctionType(f.__code__, {})
<function f at 0x1073aad00>
>>> types.FunctionType(g.__code__, {})
<function f.<locals>.g at 0x1073aadb0>
>>> g
<function f.<locals>.g at 0x1073aaba0>
>>> 

@iritkatriel iritkatriel closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants