Skip to content
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

bpo-30101: Add support for curses.A_ITALIC. #1015

Merged
merged 1 commit into from
Apr 26, 2017

Conversation

Eijebong
Copy link
Contributor

@Eijebong Eijebong commented Apr 6, 2017

No description provided.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA. This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Copy link
Member

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, but we need two more things to move this forward:

  1. Create an issue on bugs.python.org and update the PR title to include the issue number
  2. Document A_ITALIC in Doc/library/curses.rst (additionally with a .. versionadded:: 3.7 markup)

@@ -3335,6 +3335,7 @@ PyInit__curses(void)
SetDictInt("A_BLINK", A_BLINK);
SetDictInt("A_DIM", A_DIM);
SetDictInt("A_BOLD", A_BOLD);
SetDictInt("A_ITALIC", A_ITALIC);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A_ITALIC is rather a new addition so I think we should conditionally set it:

#ifdef A_ITALIC
    SetDictInt("A_ITALIC",              A_ITALIC);
#endif

@Eijebong
Copy link
Contributor Author

What should I prefix with .. versionadded:: 3.7 ?
The first or the second column ?

@berkerpeksag
Copy link
Member

Good question. I'd add the following after the first table at https://docs.python.org/3/library/curses.html#constants:

.. versionadded:: 3.7
   ``A_ITALIC`` was added.

Of course, A_ITALIC still needs to be added to the first table.

@Eijebong Eijebong changed the title Add support for curses.A_ITALIC. bpo-30101: Add support for curses.A_ITALIC. Apr 20, 2017
@@ -3335,6 +3335,9 @@ PyInit__curses(void)
SetDictInt("A_BLINK", A_BLINK);
SetDictInt("A_DIM", A_DIM);
SetDictInt("A_BOLD", A_BOLD);
#ifdef A_ITALIC
SetDictInt("A_ITALIC", A_ITALIC);
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A_ITALIC is a ncurses extension, not X/Open standard. So I think it should be put after A_VERTICAL and prefixed with a line /* ncurses extension */.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't start to "document" constants here, it's not the right place.

@@ -1294,6 +1296,9 @@ Several constants are available to specify character cell attributes:
| ``A_UNDERLINE`` | Underline mode. |
+------------------+-------------------------------+

.. versionadded:: 3.7
``A_ITALIC`` was added.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this doc change is suitable. This list lacks many options and seems only list some strict sysv options here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should I document this then ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly speaking I prefer to leave this out (no change) in this issue and just change the code. The documentation should belong to another issue, whether list all options and document their limitations, or clarifying these are some commonly available ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhangyangyu can you please stop mixing things up? I don't even know what other options are you talking about. This PR is about exposing the A_ITALIC constant. Please open a new issue to discuss your ideas on curses documentation on bugs.python.org.

The Python stdlib is full of things that are only available in specific platforms and that doesn't stop us from documenting them. See the os, sys, select modules for example. If you want to add a note that says "some of these constants may not be available in your choice of curses implementation", that's fine and we can add it in this PR.

Copy link
Member

@zhangyangyu zhangyangyu Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@berkerpeksag if you don't know what other options you should first read them. I have said in my comment the documentation problem needs another issue, not in this one.

Adding the note as you said is not suitable. Why do you only document A_ITALIC not other options? e.g. A_LEFT, A_LOW. A_ITALIC should be solved with them but not singly added which IMHO leads to confusion.

So of course we need to document A_ITALIC. But instead of singly added it in this issue, We could either opening an issue solving the documentation problem first, make this issue dependent on it, or only changing code in this issue and solve the documentation in another issue once. Considering our pace I prefer the latter choice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really want to keep this simple PR open for months or merge it without documentation changes because you've invented a new problem. I don't see any previous documentation issues relevant to this hypothetical problem on bugs.p.o. Use bugs.p.o for your random ramblings, and keep code review comments specific to the issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhangyangyu: "I am not sure this doc change is suitable. This list lacks many options and seems only list some strict sysv options here."

I concur with @berkerpeksag: while your comment is correct, we should not block this change, please open a new issue to request to complete/update the documentation.

@vstinner vstinner dismissed berkerpeksag’s stale review April 26, 2017 14:24

@berkerpeksag: "Thanks for the PR, but we need two more things to move this forward: (...)" => done, I update the status of the PR

@@ -1294,6 +1296,9 @@ Several constants are available to specify character cell attributes:
| ``A_UNDERLINE`` | Underline mode. |
+------------------+-------------------------------+

.. versionadded:: 3.7
``A_ITALIC`` was added.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: Please use three spaces:

.. versionadded:: 3.7
   ``A_ITALIC`` was added.

@berkerpeksag
Copy link
Member

done, I update the status of the PR

We now only need a Misc/NEWS entry :) @Eijebong do you have some time to add it?

@Eijebong
Copy link
Contributor Author

Eijebong commented Apr 26, 2017

Sure, I'll do it ^^

Edit: Done
Re-edit: Erf, I'll rebase
Re-re-edit: Done

@Eijebong Eijebong force-pushed the master branch 2 times, most recently from 8f4ce7a to f40ac69 Compare April 26, 2017 14:48
@zhangyangyu
Copy link
Member

@Eijebong ,if your name is not in MISC/ACKs, also need to add it.

@zhangyangyu zhangyangyu merged commit ab7886b into python:master Apr 26, 2017
@bradwood
Copy link

This appears to not be working on the my build

(yappt-PAYrWqqE) ✘-1 [brad@bradmac:~/Code/yappt] [master ↑·1|24] $ python
Python 3.7.0 (default, Jul 23 2018, 20:22:55)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
>>> curses.A_ITALIC
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'curses' has no attribute 'A_ITALIC'
>>>

@zhangyangyu
Copy link
Member

@bradwood The option is not always available. It depends on your underlying curses implementation library. For example, ncurses add the option in version 6.0, see https://invisible-island.net/ncurses/announce-6.0.html, so on my environment with a ncurses 5.0, it's not available.

@bradwood
Copy link

Ok..
Makes sense...

Having now upgraded the curses on my Mac to 6.1, how do I make python see the latest curses library? Do I need to rebuild python pointing to those headers, or can I just set an environment variable? like LDFLAGS or some such?

@zhangyangyu
Copy link
Member

@bradwood I think you need recompile.

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.

6 participants