| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Reviewer's guide (collapsed on small PRs)
Reviewer's GuideAdjusts config value interpolation to treat falsy values (like 0 and False) as valid, ensures interpolated values are always strings for re.sub, and adds a regression test for the new behavior. Class diagram for updated config interpolation in Config.processclassDiagram
class Config {
+process(value Any) Any
+get(key str) Any
}
class process_inner_resolve_from_config {
+__call__(match re_Match_str) str
}
Config ..> process_inner_resolve_from_config : defines
class re_Match_str {
+group(index int) str
}
File-Level Changes
Tips and commands Interacting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sorry, something went wrong.
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI AgentsPlease address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/poetry/config/config.py" line_range="369-370" />
<code_context>
config_value = self.get(key)
- if config_value:
- return config_value
+ if config_value is not None:
+ return str(config_value)
# The key doesn't exist in the config but might be resolved later,
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Blindly stringifying `config_value` may hide type issues and produce surprising representations for complex types.
This keeps `re.sub` happy, but it also silently coerces any type (lists, dicts, custom objects) via `str()`, which may hide misconfigurations and produce unexpected strings. Consider restricting `config_value` to specific types (e.g. `str`, numbers, bool) and raising for others, or normalizing known types to well-defined string formats.
</issue_to_address>
Sorry, something went wrong.
|
Documentation Updates 1 document(s) were updated by changes in this PR: CHANGELOGView Changes@@ -11,6 +11,7 @@
- Fix an issue where HTTP Basic Authentication credentials could be corrupted during request preparation, causing authentication failures with long tokens ([#10748](https://github.com/python-poetry/poetry/pull/10748)).
- Fix an issue where `poetry publish --no-interaction --build` requested user interaction ([#10769](https://github.com/python-poetry/poetry/pull/10769)).
- Fix an issue where `poetry init` and `poetry new` created a deprecated `project.license` format ([#10787](https://github.com/python-poetry/poetry/pull/10787)).
+- Fix an issue where falsy config values (`0`, `False`, empty string `""`) were incorrectly treated as missing during string interpolation in `config.process()`, returning the literal template string instead of the resolved value ([#10808](https://github.com/python-poetry/poetry/pull/10808)).
### Docs
|
Sorry, something went wrong.
config.process() treated falsy values (0, False, empty string) as missing, returning the literal template string instead of the resolved value. Changed the check from 'if config_value:' to 'if config_value is not None:' and added str() conversion for re.sub compatibility. Fixed return type annotation on the inner callback to match its actual return type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
config.process() treated falsy values (0, False, empty string) as missing, returning the literal template string instead of the resolved value. Changed the check from 'if config_value:' to 'if config_value is not None:' and added str() conversion for re.sub compatibility. Fixed return type annotation on the inner callback to match its actual return type.
Pull Request Check List
Resolves: #issue-number-here
Summary by Sourcery
Ensure config string interpolation correctly handles falsy values and update its typing.
Bug Fixes:
Tests: