This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Support for nested classes and function for pyclbr
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: amaury.forgeotdarc, cheryl.sabella, gpolo, rhettinger, terry.reedy, vstinner
Priority: high Keywords: patch

Created on 2009-08-12 22:47 by gpolo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
pyclbr_nested_objects.diff gpolo, 2009-08-12 22:49 review
pyclbr_nested_objects-py3k.patch amaury.forgeotdarc, 2010-10-01 23:01 review
Pull Requests
URL Status Linked Edit
PR 2503 merged cheryl.sabella, 2017-06-30 10:46
Messages (12)
msg91508 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-12 22:47
I have worked on a patch for adding support for nested classes and
nested functions in pyclbr. I believe this might be useful for some
applications, and also for issue1612262.

The patch attached also contains a test and updated documentation.
msg112311 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-01 11:00
Patch tested ok against 2.7 on windows vista.  Patch seems clean to me, can we get this committed please.
msg117847 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-10-01 23:01
Too late for version 2. I updated patch for 3.2, and tried to improve the documentation a little bit.
msg297252 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-29 04:59
Looking at the code, there are several references to nested classes, implying that they should already work.  So I might want to claim this is a behavior issue, contrary to my adding 'enhancement' before.  But moot point until patch is reviewed and otherwise ready to merge.  And 3.7 would be better than never. The patch does have a new test.
msg297292 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2017-06-29 18:26
I'm working on a PR for this.  It passed the existing test cases, but then I tried something that didn't pass, so I'm working on fixing that.
msg297301 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-29 19:53
I would like to get this in 3.7.0a1, scheduled for 2017 Sept 9, and subsequently in 3.6.3.

Cheryl, this is why I distracted you from the configdialog patch.  As a non-idlelib patch, more discussion by more people may be needed before a merge.

If this is not backported to 3.6 Lib/pyclbr, I will backport it to 3.6, maybe as Lib/idlelib/_pyclbr, or maybe as a direct addition to, replacing the import statement.
msg297331 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2017-06-30 00:06
I have the change ready to push.  I didn't change the tests, except to fix what was failing earlier, so the tests would need to be reviewed (the test currently creates a real temporary file that it opened and read, but a Mock would be better?)

Anyway, do you want me to make the PR with what I have or would you rather a new diff file?
msg297341 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-30 01:58
PR.  Also manually test classbrowser with the modified pyclbr and report what you see on your system.
msg297377 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2017-06-30 10:57
I've created the PR.  I had actually manually looked at classbrowser yesterday.  It still works just as it did before this change.  The patch in 1612262 is needed for it to loop through the new Object class.

Also, for reference, the test that didn't work initially was the case where anything was defined past the second level of nesting of a class, for example class -> def -> def or class -> def -> class.  The original patch wasn't adding those last items, but now should be.  Ironically, running this over test_pyclbr (to parse it, not to run the test), was where I saw that it wasn't showing all the nesting.
msg297622 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-04 01:31
New changeset 246ff3bd00f97658e567a7087645a6b76e056491 by terryjreedy (csabella) in branch 'master':
bpo-6691: Pyclbr now reports nested classes and functions. (#2503)
msg297623 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-04 01:40
Test_pyclbr could improve.  There are notes on the PR for a new issue for that.  If I find that further change is needed after applying to IDLE's module browser, #1612262, that will be another new issue.
msg297777 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-05 20:18
Unlinked bogus revert message.  I checked the file and it has the new function.
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50940
2017-07-05 20:18:14terry.reedysetmessages: + msg297777
2017-07-05 20:17:24terry.reedysetmessages: - msg297751
2017-07-05 13:44:56vstinnersetnosy: + vstinner
messages: + msg297751
2017-07-04 01:40:09terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg297623

stage: test needed -> resolved
2017-07-04 01:31:27terry.reedysetmessages: + msg297622
2017-06-30 10:57:11cheryl.sabellasetmessages: + msg297377
2017-06-30 10:46:00cheryl.sabellasetpull_requests: + pull_request2566
2017-06-30 01:58:34terry.reedysetmessages: + msg297341
2017-06-30 00:06:23cheryl.sabellasetmessages: + msg297331
2017-06-29 19:53:41terry.reedysetpriority: normal -> high
versions: + Python 3.7, - Python 3.6
messages: + msg297301

assignee: terry.reedy
stage: patch review -> test needed
2017-06-29 18:26:22cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg297292
2017-06-29 04:59:16terry.reedysetnosy: + terry.reedy
messages: + msg297252
2015-09-14 02:22:47terry.reedysettype: enhancement
versions: + Python 3.6, - Python 3.2
2014-02-03 19:18:11BreamoreBoysetnosy: - BreamoreBoy
2011-01-04 01:03:14pitrousetnosy: + rhettinger
2010-10-01 23:01:47amaury.forgeotdarcsetfiles: + pyclbr_nested_objects-py3k.patch
versions: - Python 3.1, Python 2.7
nosy: + amaury.forgeotdarc

messages: + msg117847
2010-08-01 11:01:00BreamoreBoysetversions: + Python 3.1
nosy: + BreamoreBoy

messages: + msg112311

stage: patch review
2009-08-12 22:51:14gpololinkissue1612262 dependencies
2009-08-12 22:49:57gpolosetfiles: + pyclbr_nested_objects.diff
dependencies: - Support for nested classes and function for pyclbr
2009-08-12 22:49:57gpolounlinkissue6691 dependencies
2009-08-12 22:49:38gpolosetfiles: - classbrowser_nesting_support.diff
2009-08-12 22:49:18gpolosetfiles: + classbrowser_nesting_support.diff
dependencies: + Support for nested classes and function for pyclbr
2009-08-12 22:49:18gpololinkissue6691 dependencies
2009-08-12 22:48:57gpolosetfiles: - pyclbr_nested_objects.diff
2009-08-12 22:47:40gpolocreate