GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-28806: Improve the netrc library by zhangyangyu · Pull Request #127 · python/cpython Conversation
zhangyangyu
force-pushed
the
workspace
branch
from
8384aca to
601b3f7
Compare
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@dmerejkowsky I wrote this patch months ago, so I have to spend some time picking it up to see if there is any possibility. Happy to see someone also interested in improving netrc. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
OK, then. Hopefully our PRs won't conflict with each other, so this not a big deal. Keep up the good work! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…tor and traceback objects __setstate__ must accept the state returned by __reduce__. This was not the case for generator and trace-back objects. This commit fixes this. The next commit (merge of issue python#127) adds the relevant test cases. Additionally amends changelog.txt. https://bitbucket.org/stackless-dev/stackless/issues/107
…ling tests. This change is based on f5f98595c6cc63b from 2.7-slp, but it is heavily modified for Python 3. - Pickle 'callable-iterator' objects correctly. Previously the unpickled object had the type '_stackless._wrap.callable-iterator'. - Fix pickling of 'method-wrapper' objects. Previously pickling them caused a SystemError exception. - Fix copy.copy() for 'callable-iterator', 'method', 'dict_keys', 'dict_values' and 'dict_items' objects. Previously the copied object had the type '_stackless._wrap....'. - Fix Stackless pickling tests. The method StacklessTestCase.dumps() didn't pass the pickle protocol to the pickler. - Remove dead code in prickelpit.c. The code was used in older Stackless versions.
…iterator' Disable the Stackless specific code for pickling 'iterator' and 'callable_iterator' objects. C-Python 3.3 already pickles them. Add tests to ensure, that Stackless can still unpickle old pickles. https://bitbucket.org/stackless-dev/stackless/issues/127
| account = lexer.get_token() | ||
| elif tt == 'password': | ||
| if os.name == 'posix' and default_netrc: | ||
| if os.name == 'posix' and default_netrc and login != "anonymous": |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This assumes that login has already been parsed, but the netrc format does not require providing login token before password token. It would be better to perform this check on storing parsed data into self.hosts[entryname], when all machine-related data is parsed and available.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
also please re base
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. versionchanged:: 3.4 Added the POSIX permission check. | ||
|
|
||
| .. versionchanged:: 3.7 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
3.8
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
you can retarget it for python 3.9
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but it may be worth to backport these changes to maintained versions. It fixes several bugs in the .netrc file parsing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. versionchanged:: 3.4 Added the POSIX permission check. | ||
|
|
||
| .. versionchanged:: 3.7 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
3.8
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| continue | ||
| if ch == "\"": | ||
| for ch in fiter: | ||
| if ch != "\"": |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would revert this condition.
if ch == '"': return token
And removed continue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.lineno = 1 | ||
| self.instream = fp | ||
| self.whitespace = "\n\t\r " | ||
| self._stack = [] |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It is not a stack, it is a queue. I suggest to rename it to pushback, as in shlex.lexer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| for ch in fiter: | ||
| if ch in self.whitespace: | ||
| continue | ||
| if ch == "\"": |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
'"'?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ch = self._read_char() | ||
| token += ch | ||
| for ch in fiter: | ||
| if ch not in self.whitespace: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The same as above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| entryname = 'default' | ||
| elif tt == 'macdef': # Just skip to end of macdefs | ||
| elif tt == 'macdef': | ||
| entryname = lexer.get_token() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You need to read and ignore the rest of the line after the macro name.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| raise NetrcParseError( | ||
| "Macro definition missing null line terminator.", | ||
| file, lexer.lineno) | ||
| if line == '\n': |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Add a comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| for host in self.hosts.keys(): | ||
| attrs = self.hosts[host] | ||
| rep = rep + "machine "+ host + "\n\tlogin " + repr(attrs[0]) + "\n" | ||
| rep = rep + "machine "+ host + "\n\tlogin " + attrs[0] + "\n" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we need a special function which escapes whitespaces and other special characters?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ch = self._read_char() | ||
| token += ch | ||
| for ch in fiter: | ||
| if ch not in self.whitespace: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I suggest to add a flag for denoting whether the terminating whitespace was '\n'. It will be helpful for comments and macdef.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@zhangyangyu, would you be able to address Serhiy's review from October? Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@csabella I am busy in my job now and this issue has been a long time even myself needs to reacquaint with it. But October seems not that hard to me. Is 3.8 going to release on October? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@zhangyangyu, sorry, I meant that Serhiy had left a comment last October, not that this needs to be looked at before the next October. The cutoff for 3.8 is this coming Monday (2019-06-03). I hope you still find time to look at it in the next few months. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hello I can continue this PR if your consider good. Cc @csabella |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @auvipy @csabella @zhangyangyu There is some plan with this PR? What's your opinion? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@eamanu I think that at this point, you can proceed with fixing the problems uncovered during code review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
So should this PR be closed? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think so. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing this PR since another PR #26330 continues and addresses comments on this thread. All reviews should move to the new PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Pays the structural debt logged by W-C2 push 45 (9e342ab). The W-C2 fix overloaded is_abs_addr=1 to trigger SIB pure-disp32 encoding in phx_fs_ptr because PhxMem zero-init couldn't distinguish 'no base register' from 'base = RAX (id=0)'. That overload was a workaround, not a fix to the underlying flaw — pythia python#127 flagged the structural-fix-rejected pattern. Fix: add explicit has_base flag to PhxMem (mirror of has_index). Constructors that take a base register (phx_ptr, phx_ptr_index, phx_a64_mem/_pre/_post) set has_base=1; pure-displacement constructors (phx_fs_ptr) leave has_base=0 via zero-init. encode_modrm_mem branches on !has_base between the is_abs_addr branch and the base-register fallback, emitting the SIB pure-disp32 form (04 25 disp32). FS segment prefix is independently emitted by emit_segment_prefix. phx_fs_ptr no longer needs the is_abs_addr workaround; restored to clean semantics (has_base=0 from zero-init is the structural marker). Other PhxMem callsite audit (no other changes needed): - frame_asm_c.c:198 label_mem: is_label_rel branch fires first - autogen_translate_c.c:1649 x86_operand_to_mem: STACK/IND use phx_ptr/ phx_ptr_index (has_base=1); MEM uses is_abs_addr (branch fires first) - arch.c:45+55 jit_arch_ptr_offset/_resolve: returns from phx_ptr (has_base=1) Note (librarian 17:27:04Z): the 1afc0fa 2026-04-06 commit was a stale-reference cleanup of a never-existing field, not a deliberate has_base rejection. DSecondary-2 is fresh ground; no prior decision is being reversed. Auth chain: theologian patch-shape APPROVE 17:50:43Z (structural verification: encoder branch order is_abs_addr → is_label_rel → !has_base → base-register fallback; ARM64 helpers correctly set has_base=1; other-callsite audit consistent); testkeeper pre-commit BUILD PASS + JIT smoke PASS 17:53:26Z; supervisor 17:18:11Z queue re-sequence (pay structural debt while surface fresh).
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.