Skip to content

bpo-35018: Sax parser provides no user access to lexical handlers.#10328

Closed
ghost wants to merge 8 commits into
masterfrom
unknown repository
Closed

bpo-35018: Sax parser provides no user access to lexical handlers.#10328
ghost wants to merge 8 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Nov 5, 2018

Copy link
Copy Markdown

This PR contains the functionality that is needed to fix bpo-6686 and bpo-9371, namely the LexicalHandler class which makes it easy to access XML comments and the document encoding. Those PR's depend on this issue.

https://bugs.python.org/issue35018

@tirkarthi

Copy link
Copy Markdown
Member

In the comment you have mentioned that this fixes issue9731 but I don't see anything in the PR related to https://bugs.python.org/issue9731 which is about adding ABCMeta.has_methods and tests for it. Please add in if I am missing something here.

Thanks!

@ghost

ghost commented Nov 6, 2018 via email

Copy link
Copy Markdown
Author

@tirkarthi

Copy link
Copy Markdown
Member

It's okay. It seems somehow the bot links the PR with ticket numbers in the PR comment. I don't know if it's intentional though. Thanks for the clarification.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please edit the title and the description of this PR.

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ghost

ghost commented Nov 7, 2018

Copy link
Copy Markdown
Author

I have made the requested changes; please review again .

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@serhiy-storchaka: please review the changes made to this pull request.

@zware zware changed the title Issue35018 bpo-35018: Sax parser provides no user access to lexical handlers. Nov 7, 2018
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Nov 8, 2018
@serhiy-storchaka serhiy-storchaka dismissed their stale review November 8, 2018 06:53

I didn't actually review this.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just few nitpicks.

Comment thread Lib/test/test_sax.py Outdated
SAXException, SAXReaderNotAvailable, SAXParseException
import unittest
from unittest import mock
from Lib.pickle import FALSE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What relation does SAX have to pickle?

Comment thread Lib/xml/sax/handler.py Outdated
version = '2.0beta'

#============================================================================
# ============================================================================

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unrelated change.

Comment thread Lib/xml/sax/handler.py Outdated
Parser, the parser will call the method in your object to
resolve all external entities. Note that DefaultHandler implements
this interface with the default behaviour."""
this interface with the default behavior."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unrelated change. Aren't both spellings correct?

@@ -0,0 +1,4 @@
Add the LexicalHandler class that is present in other SAX XML
implementations. The plumbing is already supported by Ptyhon so this simply
adds the poecelain that makes it easy for users of the Python Sax parser to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"poecelain"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also I think it's Python not Ptyhon

@ghost

ghost commented Nov 8, 2018 via email

Copy link
Copy Markdown
Author

@tirkarthi

Copy link
Copy Markdown
Member
  1. I am not a native speaker so I will defer to someone on the general tone of the documentation and the type of spelling.
  2. Many of the code predates PEP8 and the general consensus is that unless you need to change it PEP8 related changes reduces the usefulness of git history that for example to track a comment you need to use git blame and changing the whitespace adds another step while reading git history for the line. Style guidelines are generally enforced for new code or code that you happen to change but making the old code PEP8 compliant around the change that you need to make is produces little gain and it's avoided.

@ghost

ghost commented Nov 8, 2018

Copy link
Copy Markdown
Author

I have made the requested changes; please review again .

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@serhiy-storchaka: please review the changes made to this pull request.

@ghost

ghost commented Nov 8, 2018

Copy link
Copy Markdown
Author

@serhiy-storchaka Is it possible to mark issues bpo-6686 and bpo-9371 as depending on this issue bpo-35018. Both need the LexicalHandler to implement the fix and I don't have the authority to do this myself.

@serhiy-storchaka

Copy link
Copy Markdown
Member
  1. In any case this change is out of scope of this issue. Open a separate issue for fixing words in British spelling.

  2. You should use PEP 8 for new code, and can use it for modified code, but left unrelated code untouched. And consistency with other code in the file can be more important than following some PEP 8 rules. PEP 8 explicitly allows this.

@csabella csabella requested a review from scoder May 30, 2019 20:01

@scoder scoder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with the request to exclude unrelated changes from this feature PR.

Comment thread Lib/test/test_sax.py
"""This is implemented as a separate class since CDATA sections in XML
cannot appear within elements defined within a DTD. Hence this test does
not use a DTD."""
def __init__(self, *args, **kwargs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doing something in TestCase.__init__(), especially setting up test data, is a very unusual thing to do. Please use the normal set-up methods instead.

Comment thread Lib/xml/sax/handler.py
method with the property identifier
'http://xml.org/sax/handlers/LexicalHandler'."""

def xmlDecl(self, version, encoding, standalone):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This method is not part of the LexicalHandler interface.
http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@csabella

Copy link
Copy Markdown
Contributor

@jgossage, please address the code review requests. Thanks!

@csabella

Copy link
Copy Markdown
Contributor

I'm going to close this for now as the original PR author has not been active for awhile. This can be re-opened once work is ready to continue. Thanks!

@csabella csabella closed this Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants