[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin
Şahin added the comment: OK, thank you all for information. It's now clear for me too why this is not an issue. I'll try to close this issue by selecting status as close but if it isn't working with this way (I'm new, I don't know how) anyone can close this. -- stage: patch review ->

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: They are not in the __all__ list and are not documented. If __all__ is defined for the module, there is no need to use the underscore prefix for private globals. The calendar module is not special, many other modules follow this convention. --

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Paul Ganssle
Paul Ganssle added the comment: Might it be worth moving `nextmonth` and `prevmonth` to `calendar._nextmonth` and `calendar._prevmonth` to make it more clear that these are private methods? Due to Hyrum's Law, people will be using them anyway, but it could have a short deprecation period

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > On Dec 4, 2018, at 10:27 AM, Şahin wrote: > > Is there anything similar to this for "public API functions"? Yes - read the reference manual. If the function is not there it is not public. -- ___ Python

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin
Şahin added the comment: OK now it isn't a problem if we shouldn't use this function directly but how am i going to understand if a function is public API or not? In classes, we are using single or double underscore to indicate that the function or variable we're declaring is intended to be

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి
Srinivas Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) added the comment: I agree with Serhiy, nextmonth() is not a public API,you should not use it. -- nosy: +thatiparthy ___ Python tracker

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: nextmonth() is not a public API. You should not use it. If you want to make IllegalMonthError be always raised instead of IndexError for out of range month values, this is a different issue. -- ___ Python

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin
Şahin added the comment: I'm suggesting this idea to consistency. Why an IllegalMonthError exists in calendar module if we don't raise this error when required? What would you say if I asked you to "What is the month number coming after 156th month?" Would you say 157 or prefer to inform me

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the problem with current code? Can you provide an example that doesn't work correctly? -- ___ Python tracker ___

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin
Şahin added the comment: I understand you but i still think these functions need to check it. As an end-user, I shouldn't see these functions to work with no errors for illegal months. -- ___ Python tracker

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: prevmonth() and nextmonth() are internal functions. They are used only in itermonthdays3(), and the month is already checked before calling them. -- nosy: +belopolsky, rhettinger, serhiy.storchaka ___ Python

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin
Change by Şahin : -- keywords: +patch pull_requests: +10128 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin
New submission from Şahin : import calendar calendar.nextmonth(2018, 11) returns (2018, 12) which is OK. calendar.nextmonth(2018, 12) returns (2019, 1) which is also OK. calendar.nextmonth(2018, 13) returns (2018, 14). It would make more sense if this was raise calendar.IllegalMonthError.