pypa / pypa/setuptools

setuptools.dist.Distribition.__init__ formatting failure

Open
#379 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug minor
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Originally reported by: ronaldoussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren)


The init method of setuptools.dist.Distribution contains a call to warnings.warn at the end of the method. The argument to this call is a formatted using te % operator where the RHS of the call is a user provided value.

When the version argument of the distribution is a tuple this will cause a TypeError, e.g.:

#!python

   Distribution(name='test', version=(1,0))

That call specifies an invalid value for 'version', but that's no reason to crash in this way.

I have no opinion on the correct behavior, obvious options are to create an explicit tuple for the RHS, or to raise an exception for invalid input (for example DistutilsOptionError).


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at setuptools.dist.Distribution.init and reproduce the reported case with Distribution(name='test', version=(1,0)). Inspect the warnings.warn formatting path and determine a consistent handling for the invalid version value. Done means this input no longer fails with the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.