Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ISNONTERMINAL andISTERMINAL intoken.py accept float arguments in CPython but raise TypeError in PyPy #142968

Open
Labels
@EgodPrime

Description

@EgodPrime

Bug report

Bug description:

Hi, I'm working on a Python testing project, and our tool detected the following issue:

fromtokenimportISNONTERMINAL,ISTERMINALISNONTERMINAL(0.5)ISTERMINAL(0.5)

As it turned out, CPython had no complaints and executed smoothly.

However, the CPython source filetoken.py indicates that the input forISNONTERMINAL andISTERMINAL should be integer-type enumeration values, or more strictly, should only accept values defined withintoken.py.

Coincidentally, I ran the same test on the same version of PyPy and found that PyPy produced a different but more reasonable error:

TypeError: expected integer, got float object

This indicates that PyPy performs the relevant checks, even if not in the strictest form.

This may be considered an implementation bug in CPython. Type checking for input values should be supplemented to produce behavior similar to PyPy.

By the way, in my view, the approach suggested forissue 86353 is also a workable solution.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp