GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-29463: Add docstring field to some AST nodes. by methane · Pull Request #46 · python/cpython

Conversation

@methane

@methane methane commented Feb 12, 2017

Copy link
Copy Markdown
Member

ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring
field for now. It was first statement of there body.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@methane methane added the type-feature A feature request or enhancement label Feb 12, 2017
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 12, 2017
vstinner
vstinner previously requested changes Feb 12, 2017
View reviewed changes
Comment thread Doc/library/ast.rst Outdated

@vstinner vstinner Feb 12, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of its body

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@methane
methane force-pushed the ast-docstring branch from 16facf2 to e7ec3c1 Compare February 12, 2017 10:37
@codecov

codecov Bot commented Feb 12, 2017

Copy link
Copy Markdown

Codecov Report

Merging #46 into master will decrease coverage by -0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
- Coverage   82.37%   82.37%   -0.01%     
==========================================
  Files        1427     1427              
  Lines      350948   350806     -142     
==========================================
- Hits       289089   288970     -119     
+ Misses      61859    61836      -23

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2294f3a...e7ec3c1. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane
methane dismissed vstinner’s stale review February 22, 2017 10:04

fixed

@methane
bpo-29463: Add docstring field to some AST nodes.
7666aaf
ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring
field for now.  It was first statement of there body.
@methane
methane force-pushed the ast-docstring branch from e7ec3c1 to 7666aaf Compare February 22, 2017 10:08
@methane methane mentioned this pull request Feb 22, 2017
bpo-29598 Add couple of unit tests for pdb module #218
Closed
@methane
fix document. thanks travis!
68471d3
vstinner
vstinner approved these changes Feb 22, 2017
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor nit, not a blocker one.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/ast.rst Outdated

.. versionchanged:: 3.7
The docstring is exported from attribute of the node, instead of first
statement of its body.

@vstinner vstinner Feb 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the doc still sounds strange to me. I propose:

The docstring is now exported from the node docstring field, instead of the first body statement.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@methane methane Feb 22, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. In above, I feel "AsyncFunctionDef is added" wrong too. How do you think?

  • Added :class:`AsyncFunctionDef` support
  • :class:`AsyncFunctionDef` is supported now

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Feb 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right:

:class:AsyncFunctionDef is now supported.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@methane
doc fixes
56cc32e
@vstinner
vstinner merged commit cb41b27 into python:master Feb 22, 2017
@vstinner

vstinner commented Feb 22, 2017

Copy link
Copy Markdown
Member

Thanks for the last documentation fix ;-)

Nice enhancement, it should help to make AST code simpler!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Carreau

Carreau commented Feb 22, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Thanks for this ! Improvement to the AST are welcome !

Would it have been possible to make the docstring optional ? (It's already breaking things, like IPython).

Should I comment on upstream bpo ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane
methane deleted the ast-docstring branch February 22, 2017 16:31
@methane

methane commented Feb 22, 2017

Copy link
Copy Markdown
Member Author

@Carreau Yes, please discuss on bpo. Merged pull request is not good place to discussion,
because it's too hard to search.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 22, 2017

Copy link
Copy Markdown
Member

Would it have been possible to make the docstring optional ? (It's already breaking things, like IPython).

I created http://bugs.python.org/issue29622

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Carreau

Carreau commented Feb 22, 2017

Copy link
Copy Markdown
Contributor

Thanks @Haypo, responded and subscribed to both.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@myint myint mentioned this pull request May 14, 2017
Allow failure in "nightly" Python until we fix it PyCQA/pyflakes#90
Merged
@myint myint mentioned this pull request May 28, 2017
Support Python 3.7 PyCQA/pyflakes#271
Closed
tacaswell added a commit to tacaswell/sphinx-gallery that referenced this pull request Jul 9, 2017
@tacaswell
FIX: support python3.7
4575d5a
python/cpython#46 or bpo-29463

added docstring as a property to the module class that comes out of
AST (so the free strings no longer appear an the first element in the
parsed files).
@tacaswell tacaswell mentioned this pull request Jul 9, 2017
Fix py37 changes sphinx-gallery/sphinx-gallery#265
Merged
tacaswell added a commit to tacaswell/sphinx-gallery that referenced this pull request Aug 5, 2017
@tacaswell
FIX: support python3.7
11aa730
python/cpython#46 or bpo-29463

added docstring as a property to the module class that comes out of
AST (so the free strings no longer appear an the first element in the
parsed files).
tacaswell added a commit to tacaswell/jedi that referenced this pull request Oct 23, 2017
@tacaswell
FIX: install on python 3.7
821af46
python/cpython#46 /
https://bugs.python.org/issue29463 move the module comment into the
AST node and hence out of the tree which means the 2nd entry in the
tree is now the import rather than the `__version__` string.

Adds nightly on travis.
@tacaswell tacaswell mentioned this pull request Oct 23, 2017
FIX: install on python 3.7 davidhalter/jedi#971
Merged
@rogalski rogalski mentioned this pull request Nov 1, 2017
missing-docstring is emitted even with docstrings written. pylint-dev/pylint#1722
Closed
davidhalter pushed a commit to davidhalter/jedi that referenced this pull request Nov 6, 2017
@tacaswell @davidhalter
FIX: install on python 3.7 (#971)
22c97b0
* FIX: install on python 3.7

python/cpython#46 /
https://bugs.python.org/issue29463 move the module comment into the
AST node and hence out of the tree which means the 2nd entry in the
tree is now the import rather than the `__version__` string.

Adds nightly on travis.

* BLD: update python tags in setup.py

* CI: switch to 3.7-dev

* CI: allow failure on 3.7 dev
@methane methane mentioned this pull request Feb 27, 2018
bpo-32911: Add new AST node for docstring #5927
Closed
iritkatriel referenced this pull request in iritkatriel/cpython Jul 22, 2021
@iritkatriel
add num_reps to test config (#46)
59618be
@gvanrossum gvanrossum mentioned this pull request Apr 10, 2022
Test issue #47020
Closed
@dkrystki dkrystki mentioned this pull request May 3, 2022
Changes for 3.11 version break Reloadium (Hot reloader) functionality #92217
Closed
@Alexamk Alexamk mentioned this pull request Jun 2, 2022
Iterating over ChainMap.values() and ChainMap.items() updates underlying defaultdicts #93432
Closed
@pjfarley3 pjfarley3 mentioned this pull request Aug 7, 2022
os.remove() does not remove files in a sub-directory #95758
Closed
jaraco pushed a commit that referenced this pull request Dec 2, 2022
@pyup-bot @Mariatta
Initial update by pyup-bot (#46)
b39856f
* Pin pytest to latest version 3.3.2

* Pin pytest-asyncio to latest version 0.8.0

* Pin pytest-aiohttp to latest version 0.3.0

* Update cherry_picker from 0.2.5 to 0.2.7

* Pin aiohttp to latest version 2.3.9

* Pin gidgethub to latest version 2.4.1

* Pin cachetools to latest version 2.0.1

* Pin requests to latest version 2.18.4

* Pin redis to latest version 2.10.6

* Pin celery to latest version 4.1.0

* Comment out python 3.7 from travis CI
jaraco pushed a commit to jaraco/cpython that referenced this pull request Feb 17, 2023
@warsaw
Update pyproject.toml and setup.py
496f4aa
Bump version number

Closes python#46
jaraco pushed a commit to jaraco/cpython that referenced this pull request Feb 17, 2023
@warsaw
Merge branch 'issue46' into 'master'
a4ad4ce
Update pyproject.toml and setup.py

Closes python#46

See merge request python-devs/importlib_resources!47
isidentical referenced this pull request in isidentical/cpython Mar 25, 2023
@pablogsal
Merge pull request #46 from mgmacias95/fstring-grammar-rebased-after-…
081f5a2
…sprint

test: Fix fstring related tests in test_tokenize.py
oraluben pushed a commit to oraluben/cpython that referenced this pull request Jun 26, 2023
@JuliaPoo @Fidget-Spinner
Fix: infer_BINARY_OP now supports smallint input (python#46)
46f6db4
Co-authored-by: Ken Jin <[email protected]>
@gvanrossum gvanrossum mentioned this pull request Aug 22, 2023
heap-use-after-free in _PyFunction_LookupByVersion #108253
Closed
@LinanV LinanV mentioned this pull request Oct 23, 2023
Objects/typeobject.c: No such file or directory. #111203
Closed
@kcatss kcatss mentioned this pull request Feb 20, 2024
Use After Free at _heapreplace_max #115706
Closed
medmunds added a commit to medmunds/cpython that referenced this pull request Aug 1, 2024
@medmunds
Stop incorrectly RFC 2047 encoding non-ASCII email addresses
f178c2f
Email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a ValueError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS python#46.)
medmunds added a commit to medmunds/cpython that referenced this pull request Aug 1, 2024
@medmunds
Stop incorrectly RFC 2047 encoding non-ASCII email addresses
78c92ca
Email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a ValueError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS python#46.)
medmunds added a commit to medmunds/cpython that referenced this pull request Aug 1, 2024
@medmunds
Stop incorrectly RFC 2047 encoding non-ASCII email addresses
f6e590d
Email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a ValueError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS python#46.)
medmunds added a commit to medmunds/cpython that referenced this pull request Aug 1, 2024
@medmunds
Stop incorrectly RFC 2047 encoding non-ASCII email addresses
6d3b511
Email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a ValueError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS python#46.)
medmunds added a commit to medmunds/cpython that referenced this pull request Aug 1, 2024
@medmunds
Stop incorrectly RFC 2047 encoding non-ASCII email addresses
0abca3e
Email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a ValueError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS python#46.)
@ngoldbaum ngoldbaum mentioned this pull request Sep 23, 2024
Crash running PyO3 tests with --test-threads=1000 #124375
Closed
This was referenced Feb 11, 2025
segmentfault when pip installing setuptools #129992
Closed
segmentfault when pip installing setuptools #129993
Closed
@sergey-miryanov sergey-miryanov mentioned this pull request Dec 18, 2025
Observed memory leak in ssl library: Python 3.14 GC issue #142516
Closed
@ngoldbaum ngoldbaum mentioned this pull request Mar 6, 2026
Remove deprecated and undocumented function ctypes.SetPointerType #133866
Closed
bitdancer added a commit that referenced this pull request May 1, 2026
@medmunds @bitdancer
gh-83938, gh-122476: Stop incorrectly RFC 2047 encoding non-ASCII ema…
d96ffc1
…il addresses (#122540)

The email generators had been incorrectly flattening non-ASCII email
addresses to RFC 2047 encoded-word format, leaving them undeliverable.
(RFC 2047 prohibits use of encoded-word in an addr-spec.)
This change raises a HeaderWriteError when attempting to flatten an
EmailMessage with a non-ASCII addr-spec and a policy with utf8=False.
(Exception: If the non-ASCII address originated from parsing a message,
it will be flattened as originally parsed, without error.)  This also applies
to other contexts in which RFC2047 words are not allowed by the RFCs.

Non-ASCII email addresses are supported when using a policy with
utf8=True (such as email.policy.SMTPUTF8) under RFCs 6531 and 6532.

Non-ASCII email address domains (but not localparts) can also be used
with non-SMTPUTF8 policies by encoding the domain as an IDNA A-label.
(The email package does not perform this encoding, because it cannot
know whether the caller wants IDNA 2003, IDNA 2008, or some other
variant such as UTS #46.)

Co-authored-by: R. David Murray <[email protected]>
@johng johng mentioned this pull request Jul 19, 2026
use-after-free: functools partial #154189
Closed
@djarfluka djarfluka mentioned this pull request Sep 12, 2026
Heap UAF in io.TextIOWrapper read path via reentrant detach() #157363
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@methane @vstinner @Carreau @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.