Skip to content

Allow passing extra options to TerminalPdb.pt_init #12407

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
Jun 29, 2020

Conversation

kmaork
Copy link
Contributor

@kmaork kmaork commented Jun 27, 2020

Currently, subclasses of TerminalPdb (like in https://github.com/kmaork/madbg/blob/master/madbg/debugger.py#L55) will have to duplicate the entire pt_init method in order to add additional arguments for the prompt session (which accepts about 40 of them).

An example for the need to pass arguments to the prompt session would be a subclass that wants to write the prompts to a different output stream than the default. After this change it would just have to override the call to pt_init with pt_init(dict(input=input, output=output))

Currently, subclasses of TerminalPdb (like in https://github.com/kmaork/madbg/blob/master/madbg/debugger.py#L55) will have to duplicate the entire pt_init method in order to add additional arguments for the prompt session (which accepts about 40 of them). An example would be a subclass that wants to write the prompts to a different output stream than the default. After this change it would just have to override the call to pt_init with `pt_init(dict(input=input, output=output))`
@Carreau Carreau added this to the 8.0 milestone Jun 29, 2020
@Carreau Carreau merged commit 59c32f0 into ipython:master Jun 29, 2020
@Carreau
Copy link
Member

Carreau commented Jun 29, 2020

Sweet ! Nice project ! I've marked that at 8.0, but it can easily be backported to 7.x later on if you wish.

@kmaork
Copy link
Contributor Author

kmaork commented Jun 29, 2020

Thank you!! How should I go about backporting it?

@Carreau
Copy link
Member

Carreau commented Jun 29, 2020

Thank you!! How should I go about backporting it?

Once you're happy with your project, just ask and depending on how far I an in the 8.0 release I can cherry-pick the commit on 7.x, I do a 7.x release every last friday of the month.

@kmaork
Copy link
Contributor Author

kmaork commented Jun 30, 2020

Awesome, thanks!

@kmaork
Copy link
Contributor Author

kmaork commented Jul 4, 2020

Hi @Carreau ! I'm pretty happy with my project, so a backport would be awesome :)

@Carreau Carreau modified the milestones: 8.0, 7.17 Jul 6, 2020
@Carreau
Copy link
Member

Carreau commented Jul 6, 2020

@meeseeksdev backport to 7.x

meeseeksmachine pushed a commit to meeseeksmachine/ipython that referenced this pull request Jul 6, 2020
Carreau added a commit that referenced this pull request Jul 6, 2020
…407-on-7.x

Backport PR #12407 on branch 7.x (Allow passing extra options to TerminalPdb.pt_init)
@kmaork kmaork deleted the patch-1 branch December 20, 2021 13:23
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.

2 participants