Skip to content
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

Wrong unicode size detection in pybench #47342

Closed
pitrou opened this issue Jun 12, 2008 · 9 comments
Closed

Wrong unicode size detection in pybench #47342

pitrou opened this issue Jun 12, 2008 · 9 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Jun 12, 2008

BPO 3092
Nosy @malemburg, @birkenfeld, @pitrou
Files
  • pybench_ucs.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2008-07-22.18:03:24.222>
    created_at = <Date 2008-06-12.19:49:57.048>
    labels = ['type-bug']
    title = 'Wrong unicode size detection in pybench'
    updated_at = <Date 2008-07-22.18:03:24.185>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2008-07-22.18:03:24.185>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-07-22.18:03:24.222>
    closer = 'pitrou'
    components = ['Demos and Tools']
    creation = <Date 2008-06-12.19:49:57.048>
    creator = 'pitrou'
    dependencies = []
    files = ['10603']
    hgrepos = []
    issue_num = 3092
    keywords = ['patch']
    message_count = 9.0
    messages = ['68076', '68082', '68087', '68089', '68094', '68095', '68897', '69004', '70161']
    nosy_count = 3.0
    nosy_names = ['lemburg', 'georg.brandl', 'pitrou']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3092'
    versions = ['Python 3.0']

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 12, 2008

    In py3k, pybench wrongly detects UCS2 builds as UCS4. Patch attached.

    @pitrou pitrou added the type-bug An unexpected behavior, bug, or error label Jun 12, 2008
    @malemburg
    Copy link
    Member

    On 2008-06-12 21:50, Antoine Pitrou wrote:

    New submission from Antoine Pitrou <pitrou@free.fr>:

    In py3k, pybench wrongly detects UCS2 builds as UCS4. Patch attached.

    Why is that ?

    Doesn't chr(100000) raise an exception in UCS2 builds ?

    unichr(100000) does raise an exception in Py2.x.

    Note that sys.maxunicode is not available in Python 2.1
    which is why I chose try-except approach.

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 12, 2008

    Le jeudi 12 juin 2008 à 20:26 +0000, Marc-Andre Lemburg a écrit :

    Doesn't chr(100000) raise an exception in UCS2 builds ?

    No, it returns a 2-character string.

    Note that sys.maxunicode is not available in Python 2.1
    which is why I chose try-except approach.

    I understand, but is the py3k version of pybench still
    compatible with Python 2.1?

    @birkenfeld
    Copy link
    Member

    No, it returns a 2-character string.

    Which hopefully is the proper surrogate sequence :)

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 12, 2008

    Which hopefully is the proper surrogate sequence :)

    Well at least that's what the doc string says!

    @malemburg
    Copy link
    Member

    On 2008-06-12 22:58, Antoine Pitrou wrote:

    Antoine Pitrou <pitrou@free.fr> added the comment:

    Le jeudi 12 juin 2008 à 20:26 +0000, Marc-Andre Lemburg a écrit :
    > Doesn't chr(100000) raise an exception in UCS2 builds ?

    No, it returns a 2-character string.

    Interesting... I wonder how applications will deal with this. They'd
    normally expect to get a length 1 string from chr() or unichr().

    I think chr() should only behave in this way if given an option.
    Otherwise, it will definitely introduce hard to find bugs in
    ported applications (and probably even in newly written ones).

    Something like chr(x, surrogates=True) to enable returning
    2 code points instead of raising an exception.

    > Note that sys.maxunicode is not available in Python 2.1
    > which is why I chose try-except approach.

    I understand, but is the py3k version of pybench still
    compatible with Python 2.1?

    You're right: probably not. Would be great to have the test on the
    Py2.x version as well - to see the difference in performance.

    Thanks,

    Marc-Andre Lemburg
    eGenix.com

    Professional Python Services directly from the Source  (#1, Jun 12 2008)
     >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
     >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
     >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
    ________________________________________________________________________
    2008-07-07: EuroPython 2008, Vilnius, Lithuania            24 days to go

    :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611
    

    @pitrou
    Copy link
    Member Author

    pitrou commented Jun 28, 2008

    You're right: probably not. Would be great to have the test on the
    Py2.x version as well - to see the difference in performance.

    I'm not following you, what test are you talking about?
    The patch is only about reporting of the Python build characteristics,
    it does not (AFAIK) change anything to how or what tests are run.

    @malemburg
    Copy link
    Member

    On 2008-06-28 21:33, Antoine Pitrou wrote:

    Antoine Pitrou <pitrou@free.fr> added the comment:

    > You're right: probably not. Would be great to have the test on the
    > Py2.x version as well - to see the difference in performance.

    I'm not following you, what test are you talking about?
    The patch is only about reporting of the Python build characteristics,
    it does not (AFAIK) change anything to how or what tests are run.

    Sorry for the confusion. I was thinking of the new test added to
    the Py3k version of pybench - doesn't have anything to do with the
    Unicode size detection.

    @pitrou
    Copy link
    Member Author

    pitrou commented Jul 22, 2008

    Fixed in r65186

    @pitrou pitrou closed this as completed Jul 22, 2008
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants