Skip to content

Fix -o - broken in 2.6 #5445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2022
Merged

Fix -o - broken in 2.6 #5445

merged 1 commit into from
Mar 15, 2022

Conversation

Laerte
Copy link
Member

@Laerte Laerte commented Mar 8, 2022

Closes: #5444

This happen because argparse module treats the - as prefix chars: https://github.com/python/cpython/blob/main/Lib/argparse.py#L2205:L2207

Since we cannot change the internal implementation of _parse_optional i created a class that inherits from ArgumentParser class and override the method with our use case calling the default _parse_optional.

@codecov
Copy link

codecov bot commented Mar 8, 2022

Codecov Report

Merging #5445 (7659c7d) into 2.6 (23537a0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 7659c7d differs from pull request most recent head e17d831. Consider uploading reports for the commit e17d831 to get more accurate results

@@           Coverage Diff           @@
##              2.6    #5445   +/-   ##
=======================================
  Coverage   88.77%   88.78%           
=======================================
  Files         163      163           
  Lines       10666    10671    +5     
  Branches     1818     1820    +2     
=======================================
+ Hits         9469     9474    +5     
  Misses        922      922           
  Partials      275      275           
Impacted Files Coverage Δ
scrapy/cmdline.py 67.96% <100.00%> (+1.30%) ⬆️

@Gallaecio Gallaecio changed the base branch from master to 2.6 March 9, 2022 08:14
@Gallaecio
Copy link
Member

Gallaecio commented Mar 9, 2022

@Laerte Could you please rebuild your branch on top of 2.6? This is a change we would like to release in 2.6.2.

There is probably a better way, but this should do the trick:

git remote add upstream https://github.com/scrapy/scrapy.git  # unless you have already setup this remote before
git fetch upstream
git checkout upstream/2.6 -B master  # Warning: this destroys your branch contents locally; mind that if you add further commits
git cherry-pick 7d20ce65479cdbe39fc17b7cb2dc99415c670dae  # Cherry-picks your commit here; if you had added more commits before doing this, you should note their hashes and do the same with them
git push -u origin master -f  # Pushes your new master branch, which is upstream/2.6 + your commit, to your master branch, dropping the 2 upstream master commits that are not in upstream 2.6

@Laerte
Copy link
Member Author

Laerte commented Mar 9, 2022

@Gallaecio Done! Tks. 🥇

@Gallaecio
Copy link
Member

Thanks!

@Gallaecio Gallaecio merged commit c1d4be8 into scrapy:2.6 Mar 15, 2022
yash-fn pushed a commit to yash-fn/scrapy that referenced this pull request Apr 12, 2022
alexpdev pushed a commit to alexpdev/scrapy that referenced this pull request Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-o - broken in 2.6
3 participants