Skip to content

False positive for unreachable when doing OpenGL (Pyglet.gl) calls #10761

@Alez1483

Description

@Alez1483

Bug description

Making any GL calls with Pyglet.gl causes unreachable code warning even though any code afterwards is most definitely reachable. The example code below yields a warning:

from pyglet.gl import glEnable, GL_CULL_FACE

def problem_code():
    glEnable(GL_CULL_FACE)
    print("This line is unreachable apparently!")

Same function (with no branches, asserts or raises) can cause as many unreachable warnings as there are GL calls. The line of the warning is always the next line from the GL call which if another GL call, causes yet another unreachable warning. GL call with no code afterwards does not cause an unreachable warning.

For instance:

glFunctionCall...
glFunctionCall... #false positive unreachable
glFunctionCall... #false positive unreachable
print... #false positive unreachable

Command used

pylint test.py

Pylint output

Module ...test
test.py:5:4: W0101: Unreachable code (unreachable)

Expected behavior

The code should not yield any warnings (outside missing-docstring ones if enabled).

Pylint version

pylint 4.0.3
astroid 4.0.2
Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)]

OS / Environment

Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeLib specific 💅This affect the code from a particular libraryNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenning

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions