Skip to content

Unexpected space with blurb merge and python 3.4 #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JulienPalard opened this issue Aug 4, 2017 · 3 comments
Closed

Unexpected space with blurb merge and python 3.4 #171

JulienPalard opened this issue Aug 4, 2017 · 3 comments
Labels

Comments

@JulienPalard
Copy link
Member

For the following lines in the cpython 3.4 branch (commit 362e9fb):

$ git grep -C1 'Pythons use gcc-4.0 and the 10.4u' Misc/NEWS.d/
Misc/NEWS.d/3.3.0a1.rst-Distutils LDSHARED configuration variable for OS X. (Note, the python.org
Misc/NEWS.d/3.3.0a1.rst:32-bit-only Pythons use gcc-4.0 and the 10.4u SDK, neither of which are
Misc/NEWS.d/3.3.0a1.rst-available in Xcode 4.  This change does not attempt to override settings to

using Python 3.5 to execute blurb merge correctly gives:

OS X. (Note, the python.org 32-bit-only Pythons use gcc-4.0 and the 10.4u

But running blurb merge with Python 3.4.3 gives a space between 32 and -bit:

OS X. (Note, the python.org 32 -bit-only Pythons use gcc-4.0 and the 10.4u

It's expected (#170 (comment)) that this is simply an issue from textwrap.wrap that has been fixed between 3.4 and 3.5.

@JulienPalard JulienPalard changed the title Unwanted space with blurb merge and python 3.4 Unexpected space with blurb merge and python 3.4 Aug 4, 2017
@larryhastings
Copy link
Contributor

I traced it down. Here's a minimal test case:

text = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n32-bit-only'

import textwrap
x = textwrap.wrap(text, width=76)
print(x)

Without the bugfix, the line is split between "32" and "-". With the bugfix applied "32-bit-only" remains one word.

The behavior was changed in git revision 72bd327db0b, checked in 2015-03-24 by Serhiy Storchaka, in regards to issue bpo-22687 ("horrible performance of textwrap.wrap() with a long word"). This made it into 3.5.0a3, but has never been backported to 3.4, and at this point it shouldn't be as 3.4 is in security-fixes-only mode.

So, uh, maybe blurb can't support 3.4? Unless we wanna do something crazy like monkeypatch textwrap or something.

@JulienPalard
Copy link
Member Author

We'll have to hear from the infra team about the possibility of upgrading Python. I went on the path of backporting blurb to 3.4 because it seemed easier and faster (and was not excluding a future upgrade). If it's hard, it's the wrong way.

The compromise may be: If the software upgrade take a long time, we'll still be able to merge this so blurb work (with a single strange space) in the meantime. I don't know what it take, I'll ask.

@JulienPalard
Copy link
Member Author

I'm closing this. Won't fix as this is a bug in textwrap, and blurb won't support Python 3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants