Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 654
    • Issues 654
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPy
  • pypypypy
  • Issues
  • #3573

Closed
Open
Created Oct 11, 2021 by Oliver Margetts@olliemathDeveloper

Misleading import error

Issue

With current 3.8 rc2, or latest nightly, create a directory somedir. Then issue

from somedir import something

this results in a pretty cryptic traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected str, got NoneType object

Because it raises a TypeError, rather than an ImportError, this actually breaks some libraries with optional dependencies (for example gevent).

Expected behaviour

The cpython 3.8 error message is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'something' from 'somedir' (unknown location)

In pypy3.7 we used to get something slightly different, but equally helpful:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'something'
Edited Oct 11, 2021 by Oliver Margetts
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking