[Bug 1021783] Re: invalid behavior of curses.newpad().refresh()

Jason Conti 1021783 at bugs.launchpad.net
Thu Jul 26 19:59:43 UTC 2012


** Description changed:

+ [Precise SRU Justification]
+ 
+ Valid python programs using the refresh method with the optional
+ arguments on a curses.newpad object will fail with a similar exception:
+ 
+ Traceback (most recent call last):
+   File "newpad-refresh.py", line 10, in <module>
+     pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1)
+ TypeError: refresh() takes exactly 0 arguments (6 given)
+ 
+ This breaks at least one of the examples in the python documentation and
+ I believe limits the usefulness of the pad object, since it allows one
+ to only display a portion of the pad with the refresh method.
+ 
+ [Fix]
+ 
+ Updates the ncursesw-include.diff patch with the version in quantal,
+ adding /usr/include/ncursesw/ to the search path in configure.in. This
+ allows the build scripts to find curses and builds the curses module
+ with the correct number of arguments to refresh.
+ 
+ [Regression Potential]
+ 
+ The regression potential should be minor since it just enables a build
+ option already enabled on the python2.7 package (as well as python3.2
+ and python3.3 in quantal).
+ 
+ [Test Case]
+ 
+ Running the following code with python3 will produce the above exception
+ without the patch, and prompt to "press q" to quit the script with the
+ patch.
+ 
+ ##########################################
+ import curses
+ 
+ try:
+     screen = curses.initscr()
+     curses.cbreak()
+ 
+     pad = curses.newpad(10, 10)
+     pad.addstr(0, 0, "press q")
+     size = screen.getmaxyx()
+     pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1)
+     while True:
+         ch = pad.getch()
+         if ch == ord("q"):
+             break
+         pass
+     pass
+ finally:
+     curses.nocbreak()
+     curses.endwin()
+     pass
+ ###########################################
+ 
+ ===============================================================================
+ 
  There is invalid behavior of builtin curses module in amd64 version
  python3.2.
  
  From API spec, `refresh()` method of a window object returned by
  `curses.newpad(h,w)` should accept 6 arguments; `pad.refresh(pt, pl, st,
  sl, sb, sr)`.
  
  - http://docs.python.org/py3k/library/curses.html#curses.newpad
  
  But python3.2 package in amd64 ubuntu precise does not accept arguments.
  
- [bug occured snippet: newpad-refresh.py]
- ##########################################
- import curses
- 
- try:
-     screen = curses.initscr()
-     curses.cbreak()
- 
-     pad = curses.newpad(10, 10)
-     pad.addstr(0, 0, "press q")
-     size = screen.getmaxyx()
-     pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1)
-     while True:
-         ch = pad.getch()
-         if ch == ord("q"):
-             break
-         pass
-     pass
- finally:
-     curses.nocbreak()
-     curses.endwin()
-     pass
- ###########################################
- 
- [execution result]
- ###########################################
- $ python3 newpad-refresh.py 
- Traceback (most recent call last):
-   File "newpad-refresh.py", line 10, in <module>
-     pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1)
- TypeError: refresh() takes exactly 0 arguments (6 given)
- ###########################################
  
  The code is worked well on python2.7 pakcage and self compiled python3.2.3.
  There may be a package build problem at python3.2 or ncurses.
  
  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: python3.2 3.2.3-0ubuntu3
  ProcVersionSignature: Ubuntu 3.2.0-26.41-generic 3.2.19
  Uname: Linux 3.2.0-26-generic x86_64
  ApportVersion: 2.0.1-0ubuntu8
  Architecture: amd64
  Date: Sat Jul  7 00:09:05 2012
  ProcEnviron:
-  TERM=xterm
-  PATH=(custom, user)
-  LANG=ja_JP.UTF-8
-  SHELL=/bin/bash
+  TERM=xterm
+  PATH=(custom, user)
+  LANG=ja_JP.UTF-8
+  SHELL=/bin/bash
  SourcePackage: python3.2
  UpgradeStatus: Upgraded to precise on 2012-03-21 (106 days ago)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3.2 in Ubuntu.
https://bugs.launchpad.net/bugs/1021783

Title:
  invalid behavior of curses.newpad().refresh()

Status in “python3.2” package in Ubuntu:
  Fix Released

Bug description:
  [Precise SRU Justification]

  Valid python programs using the refresh method with the optional
  arguments on a curses.newpad object will fail with a similar
  exception:

  Traceback (most recent call last):
    File "newpad-refresh.py", line 10, in <module>
      pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1)
  TypeError: refresh() takes exactly 0 arguments (6 given)

  This breaks at least one of the examples in the python documentation
  and I believe limits the usefulness of the pad object, since it allows
  one to only display a portion of the pad with the refresh method.

  [Fix]

  Updates the ncursesw-include.diff patch with the version in quantal,
  adding /usr/include/ncursesw/ to the search path in configure.in. This
  allows the build scripts to find curses and builds the curses module
  with the correct number of arguments to refresh.

  [Regression Potential]

  The regression potential should be minor since it just enables a build
  option already enabled on the python2.7 package (as well as python3.2
  and python3.3 in quantal).

  [Test Case]

  Running the following code with python3 will produce the above
  exception without the patch, and prompt to "press q" to quit the
  script with the patch.

  ##########################################
  import curses

  try:
      screen = curses.initscr()
      curses.cbreak()

      pad = curses.newpad(10, 10)
      pad.addstr(0, 0, "press q")
      size = screen.getmaxyx()
      pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1)
      while True:
          ch = pad.getch()
          if ch == ord("q"):
              break
          pass
      pass
  finally:
      curses.nocbreak()
      curses.endwin()
      pass
  ###########################################

  ===============================================================================

  There is invalid behavior of builtin curses module in amd64 version
  python3.2.

  From API spec, `refresh()` method of a window object returned by
  `curses.newpad(h,w)` should accept 6 arguments; `pad.refresh(pt, pl,
  st, sl, sb, sr)`.

  - http://docs.python.org/py3k/library/curses.html#curses.newpad

  But python3.2 package in amd64 ubuntu precise does not accept
  arguments.


  The code is worked well on python2.7 pakcage and self compiled python3.2.3.
  There may be a package build problem at python3.2 or ncurses.

  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: python3.2 3.2.3-0ubuntu3
  ProcVersionSignature: Ubuntu 3.2.0-26.41-generic 3.2.19
  Uname: Linux 3.2.0-26-generic x86_64
  ApportVersion: 2.0.1-0ubuntu8
  Architecture: amd64
  Date: Sat Jul  7 00:09:05 2012
  ProcEnviron:
   TERM=xterm
   PATH=(custom, user)
   LANG=ja_JP.UTF-8
   SHELL=/bin/bash
  SourcePackage: python3.2
  UpgradeStatus: Upgraded to precise on 2012-03-21 (106 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.2/+bug/1021783/+subscriptions




More information about the foundations-bugs mailing list