[issue32308] Replace empty matches adjacent to a previous non-empty match in re.sub()

2020-01-20 Thread David Barnett


David Barnett  added the comment:

We were also bitten by this behavior change in 
https://github.com/google/vroom/issues/110. I'm kinda baffled by the new 
behavior and assumed it had to be an accidental regression, but I guess not. If 
you have any other context on the BDFL conversation and reasoning for calling 
this behavior correct, I'd love to see additional info.

--
nosy: +mu_mind

___
Python tracker 
<https://bugs.python.org/issue32308>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25012] pathlib should allow converting to absolute paths without resolving symlinks

2015-09-08 Thread David Barnett

David Barnett added the comment:

Right, and to clarify a bit further why I didn't just use A.resolve() == 
B.resolve() from the beginning, this is in a unit test where the equality check 
wasn't in my code. I wanted to assert I received a certain call on my mock, like
  mock_open_method.assert_called_once_with(pathlib.Path('foo'))
so it's much more convenient to be able to create a path object that matches 
with my target path instead of more complicated matching.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25012>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25012] pathlib should allow converting to absolute paths without resolving symlinks

2015-09-08 Thread David Barnett

David Barnett added the comment:

And the symlinks for my paths refer to really cryptic hashes in a virtual 
filesystem for the tests, so rendering them into the assertion failed errors 
would really make the failure messages hard to interpret.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25012>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25012] pathlib should allow converting to absolute paths without resolving symlinks

2015-09-05 Thread David Barnett

New submission from David Barnett:

There doesn't seem to be any helper in pathlib to expand a relative path to an 
absolute path *without* resolving symlinks.

For example, if I want to convert
  pathlib.Path('some/path')
to
  pathlib.Path('/full/path/to/some/path')
where some/path is a symlink, my best option seems to be
  pathlib.Path(os.path.abspath(str(pathlib.Path('some/path'

--
components: Library (Lib)
messages: 249936
nosy: mu_mind
priority: normal
severity: normal
status: open
title: pathlib should allow converting to absolute paths without resolving 
symlinks
type: behavior
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25012>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22710] doctest exceptions include nondeterministic namespace

2014-10-23 Thread David Barnett

New submission from David Barnett:

doctests includes special exception processing support (described in 
https://docs.python.org/3/library/doctest.html#what-about-exceptions), but in 
python3 it seems to print the fully-qualified class name even for exception 
classes in the same module, which makes the expected output vary between py2 
and py3.

For instance, given a file spam/eggs.py with these contents:
  class Error(Exception):
  Spam, Bacon, and Spam
  
   raise Error()
  Traceback (most recent call last):
  ...
  Error
  
running the command
  python3 -m doctest spam/eggs.py
will fail expecting eggs.Error instead of just Error.

If you instead invoke it with the command
  nosetests3 --with-doctest spam/eggs.py
it will fail expecting yet another name, spam.eggs.Error.

It may be possible to work around issues like this using ELLIPSIS, but it makes 
the doctests harder to read and it really seems like at least exception classes 
defined in the same file should be able to match by just their short class name.

--
components: Library (Lib)
messages: 229864
nosy: mu_mind
priority: normal
severity: normal
status: open
title: doctest exceptions include nondeterministic namespace
type: behavior
versions: Python 3.2, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22710
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22710] doctest exceptions include nondeterministic namespace

2014-10-23 Thread David Barnett

David Barnett added the comment:

But… that doesn't help. It completely changes the semantics of the doctests. I 
have a bunch of doctests demonstrating different failures of the same exception 
class, and with IGNORE_EXCEPTION_DETAIL running my doctests to verify they're 
still correct is next to useless. Plus it's very noisy to slap # doctest: 
+IGNORE_EXCEPTION_DETAIL everywhere just to get not-pathological behavior.

And this isn't even just about py2/py3 interoperability. It's a problem for my 
py3-only project, which fails depending on how I invoke doctests. So it's not 
just something we can hack around until py2 goes away and be fine.

Can't a separate option be added for just the module name and enabled by 
default?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22710
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20298] json library needs a non-strict option to decode single-quoted strings

2014-01-18 Thread David Barnett

New submission from David Barnett:

Many sloppy JSON APIs return data with poorly-encoded strings, either with 
single-quotes as delimiters:
  {'foo': 'bar'}
or with no delimiters at all on keys:
  {foo: 'bar'}

The json library is useless for making sense of this data, because all it will 
tell you is No JSON object could be decoded.

It would be incredibly helpful if the json library had some special non-strict 
decoding mode that could interpret these common misspellings of JSON strings. 
Or, more generally, it could accept another decoder hook to reformat the 
remaining string, something like:
  def malformed_hook(remaining, parent):
  if remaining.startswith('):
  # We know this is a string, regex it to find the end.
  m = re.match(pyparsing.quotedString.reString, remaining)
  if m is not None:
  # Use json.dumps to add quotes around string literal.
  return json.dumps(eval(m.group(0))) + remaining[m.end():]
  # If we're inside an object, this could be a naked object key.
  if isinstance(parent, dict):
  m = re.match(r'([a-zA-Z_]\w*):', remaining)
  if m is not None:
  return json.dumps(m.group(1)) + remaining[len(m.group(1)):]
  print(json.loads(['foo', null, {a: 'b'}], malformed_hook=malformed_hook))
  ['foo', None, {'a': 'b'}]

This would at least save you having to write a parser/tokenizer from scratch.

--
components: Library (Lib)
messages: 208430
nosy: mu_mind
priority: normal
severity: normal
status: open
title: json library needs a non-strict option to decode single-quoted strings
type: enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20298
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1065986] Fix pydoc crashing on unicode strings

2012-11-11 Thread David Barnett

David Barnett added the comment:

I guess it must be more complicated than it looks, because I thought checking 
for unicode strings and doing .encode('utf-8') would help at least some cases 
without making anything worse.

Anyways, if it's too hard or not worth fixing correctly, couldn't we at least 
do something to prevent a crash? Maybe strip out / replace special characters 
and try again?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1065986
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1065986] Fix pydoc crashing on unicode strings

2012-11-10 Thread David Barnett

Changes by David Barnett davidbarne...@gmail.com:


--
nosy: +mu_mind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1065986
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1065986] Fix pydoc crashing on unicode strings

2012-11-10 Thread David Barnett

David Barnett added the comment:

I just ran into this, and I'd like to communicate how unfortunate it is that 
it's not a priority to fix this fairly trivial (?) bug. It means there's no way 
to define a unicode string literal with non-ascii characters that won't crash 
the builtin help() command.

I ran into this with the desktop package (http://pypi.python.org/pypi/desktop) 
where the only useful documentation right now is the source code and the 
docstrings. Apparently the author, who has non-ascii characters in his name, 
did me a favor by using broken encoding on the doc string so that at least I 
could read everything except for his name in the help. I tried to correct the 
encoding and found I get a nice traceback instead of help. And to top it all 
off, googling for things like help unicode docstring and python help ascii 
codec turns up nothing. I only found this issue once I thought to include 
pipepager in the search...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1065986
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1065986] Fix pydoc crashing on unicode strings

2012-11-10 Thread David Barnett

David Barnett added the comment:

Also, the resolution is still marked as fixed, which is not correct...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1065986
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11880] add a {dist-info} category to distutils2

2012-06-14 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

Is this ready and just waiting to be merged now?

--
nosy: +mu_mind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11638] python setup.py sdist crashes if version is unicode

2011-10-29 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

Here's a test for the bug.

--
keywords: +patch
Added file: http://bugs.python.org/file23548/test_unicode_sdist.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11638
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11638] python setup.py sdist crashes if version is unicode

2011-10-29 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

One way to fix the symptom (maybe not the correct way) would be to edit 
tarfile._Stream._init_write_gz and change the line that reads
  self.__write(self.name + NUL)
to something like
  self.__write(self.name.encode('utf-8') + NUL)

tarfile is building up an encoded stream of bytes, and whatever self.name is it 
needs to be encoded before being inserted into the stream. I'm not positive 
UTF-8 is right, and maybe it should only convert if isinstance(self.name, 
unicode).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11638
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13170] distutils2 test failures

2011-10-28 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

 The remaining test 
 (test_command_install_data.InstallDataTestCase.test_simple_run) was
 broken in r1152.
This looks like a local revision number, which has no meaning outside of one 
specific repository.  What is the changeset identifier?  (see 
http://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html#id345536)
Oh, sorry, it's d1d251292ee7. (I got the short rev from the hg.python.org 
interface, so I thought it would be authoritative enough, but I guess it is 
ambiguous)

 importing shutil from the stdlib is broken in that file besides.
 I don’t understand this.
When I do import shutil inside _backport/shutil.py, it seems to be importing 
itself (??) if I don't explicitly enable absolute imports (in python 2.7). If I 
delete the class Error definition and instead add from shutil import Error, 
I get an ImportError.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13170
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13170] distutils2 test failures

2011-10-27 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

The remaining test 
(test_command_install_data.InstallDataTestCase.test_simple_run) was broken in 
r1152. What's happening is that the type of exception being raised was changed 
and it's getting through the try/except block in install_data.run().

Instead of calling shutil.copyfile, the code in 1152 is calling 
distutils2._backport.shutil.copyfile, which instead of raising a shutil.Error 
instance raises a distutils2._backport.shutil.Error instance.

Ideally, I think distutils2/_backport/shutil.py should do from shutil import 
Error instead of defining its own Error class, but I'm not sure if that's 
kosher for the way backports are supposed to work, and importing shutil from 
the stdlib is broken in that file besides.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13170
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13205] NameErrors in generated setup.py (codecs, split_multiline)

2011-10-18 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

Sure, I can give it a go. I'll probably have a chance sometime today.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13205
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13205] NameErrors in generated setup.py (codecs, split_multiline)

2011-10-18 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

Regression tests. Not positive that subprocess is the best approach for running 
these, but it seems to work.

In the process of writing tests, I discovered another missing import for 
PackagingFileError when there's no setup.cfg.

--
Added file: http://bugs.python.org/file23458/test_command_generate_setup.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13205
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8668] Packaging: add a 'develop' command

2011-10-17 Thread David Barnett

Changes by David Barnett davidbarne...@gmail.com:


--
nosy: +mu_mind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8668
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13205] NameErrors in generated setup.py (codecs, split_multiline)

2011-10-17 Thread David Barnett

New submission from David Barnett davidbarne...@gmail.com:

The setup.py file currently generated by pysetup generate-setup fails to 
import the codecs module, and also uses a split_multiline function from 
distutils2/utils.py that's undefined in the setup script.

--
assignee: tarek
components: Distutils2
files: fix_nameerrors.patch
keywords: patch
messages: 145768
nosy: alexis, eric.araujo, mu_mind, tarek
priority: normal
severity: normal
status: open
title: NameErrors in generated setup.py (codecs, split_multiline)
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file23435/fix_nameerrors.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13205
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11638] python setup.py sdist crashes if version is unicode

2011-10-17 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

I'm getting this exact error when I run python setup.py sdist, no matter what 
I do. Even if I just create a new project, type 1.0.0 for version, type a 
in all the other fields, and say no to every question; then run pysetup 
generate-setup and python setup.py sdist.

--
nosy: +mu_mind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11638
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13170] distutils2 test failures

2011-10-17 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

I looked into the ConfigTestCase.test_config failure, and it looks like it just 
needs the righthand edited to match the left. package_data lines are supposed 
to allow comma-separated lists of paths on the righthand.

--
nosy: +mu_mind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13170
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13170] distutils2 test failures

2011-10-17 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

The ConfigTestCase.test_parse_extensions_in_config failure is a manifestation 
of http://bugs.python.org/issue6988.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13170
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11240] Running unit tests in a command line tool leads to infinite loop with multiprocessing on Windows

2011-05-29 Thread David Barnett

Changes by David Barnett davidbarne...@gmail.com:


--
nosy: +mu_mind

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11240
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10198] wave module writes corrupt wav file for zero-length writeframes

2010-10-26 Thread David Barnett

New submission from David Barnett davidbarne...@gmail.com:

If the first call to writeframes happens to take an empty string as the data to 
write, then the next call to writeframes writes a 2nd header into the file, and 
forever after fails to patch the data length correctly.

--
components: Library (Lib)
messages: 119609
nosy: mu_mind
priority: normal
severity: normal
status: open
title: wave module writes corrupt wav file for zero-length writeframes
type: behavior
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10198
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10198] wave module writes corrupt wav file for zero-length writeframes

2010-10-26 Thread David Barnett

David Barnett davidbarne...@gmail.com added the comment:

This patch against the python 2.6 version fixes the problem for me.

--
keywords: +patch
Added file: http://bugs.python.org/file19369/fix_double_header.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10198
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com