[issue27623] int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero

2016-07-28 Thread Anders Lorentsen
Anders Lorentsen added the comment: So, am I to understand that the only corner case we should fix is that >>> (-1).to_bytes(0, 'big', signed=True) should raise an overflow error (currently it returns b'') ? -- Added file: http://bugs.python.org/

[issue27623] int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero

2016-07-29 Thread Anders Lorentsen
Anders Lorentsen added the comment: I updated my patch to account for that second corner case. But ideally, shouldn't it rather be accounted for in the function that does the actual conversion, that is, in _PyLong_AsByteArray? -- Added file: http://bugs.python.org/file43942

[issue27623] int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero

2016-07-27 Thread Anders Lorentsen
Changes by Anders Lorentsen <pha...@gmail.com>: -- nosy: +Phaqui ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27623> ___ __

[issue27623] int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero

2016-07-27 Thread Anders Lorentsen
Anders Lorentsen added the comment: Isn't it possible to just add a small line of code that checks if length is less than or equal to 0, and if it is, call the necessary c functions to have python raise a valueerror...? Sorry if this is giving a solution without actually submitting the patch

[issue31956] Add start and stop parameters to the array.index()

2017-11-13 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: Writing my tests, I originally looked at Lib/test/seq_tests.py. One test case uses indexes that are (+-)4*sys.maxsize. This does not fit in Py_ssize_t, and so these tests cause my array implementation to raise an overflow exc

[issue31956] Add start and stop parameters to the array.index()

2017-11-12 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: I decided to work on this, and I would like some review, as this would be my second contribution to cpython. Also, a general question: As I defined the start and end arguments Py_ssize_t, bigger indexes (more negative or more po

[issue31843] sqlite3.connect() should accept PathLike objects

2017-11-06 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: Had my first go at a python patch. Added a test case for it, and all tests passing when I test with `./python -bb -E -Wd -m test -v test.test_sqlite -r -w -uall -R 3:2` -- nosy: +

[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2017-11-06 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: I was able to make a test that reproduces your code, and expectedly fails. Also implemented a fix for it. See a temporary diff here: https://pastebin.com/C9JWkg0i However, there is also a specific MS Windows version of _execute

[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2017-11-07 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: While researching this, I discovered that on MS Windows >>> subprocess.run([pathlike_object, additional_arguments]) did not run like it did on Posix. My PR includes this probl

[issue32764] Popen doesn't work on Windows when args is a list

2018-02-04 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: This is strange, because _execute_child calls os.fsdecode with `args` as the argument, which may be a list. os.fsdecode calls fspath. Now, the python docstring of _fspath, as defined in Lib/os.py on line 1031, clearly

[issue32764] Popen doesn't work on Windows when args is a list

2018-02-04 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: Also, isn't there continuous integration testing? Everything passed on the PR, so where does this come from? -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32764] Popen doesn't work on Windows when args is a list

2018-02-04 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: Wait a minute. The failing test is test_nonexisting_with_pipes, and it fails because args[0] is a tuple - how can that be? Nobody is supposed to pass cmd=sequence-where-first-element-is-a-tuple! Is everything all right with th

[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2018-02-05 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: > # runs this weird file > subprocess.run([bin]) > # Currently an error; if this is implemented, would run > # /bin/ls, and pass it the -l argument. Refers to something > # completely different than our .exist

[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2018-02-06 Thread Anders Lorentsen
Anders Lorentsen <pha...@gmail.com> added the comment: What do you mean "is a bug", and "the PR would encourage this"? Can't it be fixed? Are you saying that just because it is a bug now, we should be discouraged from making it work in the way you'd expect it to

[issue31956] Add start and stop parameters to the array.index()

2019-08-27 Thread Anders Lorentsen
Anders Lorentsen added the comment: As far as I can recall, the patch is generally speaking good to go. A number of discussions arose on various details, however. In any event, I'll take a look at it during the next few days. -- ___ Python

[issue31956] Add start and stop parameters to the array.index()

2019-09-15 Thread Anders Lorentsen
Anders Lorentsen added the comment: I have actually managed to lost my local branch of this fix, though I assume I can just start another one, manually copy over the changes, somehow mark this current PR as cancelled, aborted, or in my option the best: "replaced/superseeded by: [n

[issue38673] REPL shows continuation prompt (...) when comment or space entered

2019-11-07 Thread Anders Lorentsen
Anders Lorentsen added the comment: As a person without much experience, it sounded like a simple enough task, but having dug a bit, I found it quite complicated. It seems to me that the interpreter loop (in the standard REPL, that you get when you start ./python, blocks for input somewhere